Server Fault is a question and answer site for system and network administrators. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I used Webmin to setup a basic Samba share on my server. Webmin created my smbusers from the available linux users. But it left all of their smbpassword's as blank instead of using their linux user passwords.

How can I setup Samba so that it uses or sync's passwords with user's linux user passwords?

share|improve this question

You can configure samba to use PAM, and therefore to use the same list of users for authentication as already present on your system, including using their current passwords. Exhaustive details are available on the official samba site here.

A small word of caution though - you will probably need to delve directly into the configuration files, I'm not sure you can make the requisite changes via webmin.

share|improve this answer
Note that Samba will have to run as the root user if you are using PAM authentication, though there is really little that you can do about this. Samba 4 clears this up a bit by not relying on the underlying host to provide accounts, it uses its own account database (which makes life a lot easier, as that means that you can run an SSH server on the system without having to restrict who can login to it). Then other applications/systems on your network can be configured to use Samba4's LDAP and Kerberos. However, Samba 4 is not yet ready for production use. – Michael Trausch Jul 25 '11 at 20:12
You can't use PAM for authentication. The PAM API only allows verification of plain text passwords, whereas Samba only gets an encrypted password for the client. The PAM integration in Samba can only be used for PAM session modules and the like. – jelmer Jul 25 '11 at 20:47

On Debian and it's derivatives you can follow the instructions here to get them to sync. I'm pretty sure something like this can be done on other distributions pretty easily.

Looking at the password section in the Samba manual, it seems Samba has a built in way to do it with:

unix password sync = yes

Which will update the system password for the user when the Samba password is changed - i.e. you must change the password for users with Samba, not with passwd.

share|improve this answer
Depending on the exact system and if any modifications are made, additional configuration settings will have to be set in the smb.conf file such that Samba knows exactly what commands to run to set the user's passwords in order for the sync process to work. Additionally, it might be useful to have some scripts on the server that you can use to provision accounts in both UNIX and Samba at the same time; that's what I do for account provisioning and password resets. – Michael Trausch Jul 25 '11 at 20:14
@ Michael - do you have an example of such a script that you would be willing to share? – John Oct 10 '11 at 17:14

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.