The /etc/smbpasswd file is the Samba encrypted password file. It contains the username; Unix UID and SMB hashed passwords of the allowed users to your Samba server, as well as account flag information and the time the
password was last changed. It's important to create this password file and include all allowed users to it before your clients try to connect to your Samba server. Without this step, no one will be able to connect to your Samba server.
To create a Samba account you must first have a valid Linux account for them, so create in your
etc/passwdfile all the users you want to connect to your Samba server first before generating thesmbpasswdfile of Samba.To add a new users to your
/etc/passwdfile, use the following commands:[root@deep ] /# useradd smbclientTo add password for users in your
/etc/passwdfile, use the following commands:[root@deep ] /# passwd smbclientChanging password for user smbclient New UNIX password: Retype new UNIX password: passwd: all authentication tokens updated successfully
Once we have added all Samba clients in our
/etc/passwdfile on the Linux server, we can now generate thesmbpasswdfile from the/etc/passwdfile. To generatesmbpasswdfile from the/etc/passwdfile, use the following commands:[root@deep ] /# cat /etc/passwd | mksmbpasswd.sh > /etc/smbpasswdFinally, the last step we must perform is to create the Samba user account in our
/etc/smbpasswdfile before we are able to use it. To create theSambauser account, use the following commands:[root@deep ] /# smbpasswd -a smbclient
New SMB password: Retype new SMB password: Added user smbclient. Password changed for user smbclient.Don't forget to change the permission of your new
smbpasswdfile to be readable and writable only by the super-userroot, and nothing for group and other0600/-rw-------This is a security measure.[root@deep ] /# chmod 600 /etc/smbpasswd [root@deep ] /# testparm
See
ENCRYPTION.txtinsamba/doc/texts/for more information.