I don’t know how many times I’ve had people reach out to me to say, “Help, I can’t get users to successfully authenticate against a Samba share! What do I do?” After years of helping people with this issue, the answer is pretty rote by now. To most people’s surprise, the resolution to this problem is quite simple. What it is? You have to add and enable the users, such that Samba knows they exist.
What? Wait! The users are there on the system. They can log into their accounts on the Samba server. Shouldn’t that be enough? In a word, no. Even though the system is aware of the users, Samba is not. But don’t worry, the solution can be solved with two easy commands. Here’s what you do.
Open up a terminal window on your Samba server (or just log in, if it’s a headless machine) and issue the following command sudo smbpasswd -a USER (where USER is the username to be added). You will be prompted to enter and verify a new password for the user. Next issue the command sudo smbpasswd -e USER and the user will be enabled for Samba shares.
When the user attempts to authenticate to a Samba share, it’ll now actually work.
This is one of those often overlooked steps that can drive a Samba administrator crazy. Make sure to always add and enable users for Samba, otherwise, no matter what you do, they won’t be able to log into those shares.
Subscribe to the Developer Insider Newsletter
From the hottest programming languages to commentary on the Linux OS, get the developer and open source news and tips you need to know. Delivered Tuesdays and Thursdays