
There are three "backends" (or ways) of storing usernames and password with Samba.
- tdbsam (trivial database sam)
- smbpasswd (samba smb password database)
- ldapsam (ldap sam)
The backend is defined in the global section of your smb.conf file.
[global]
passdb backend = tdbsam
AVOID TROUBLE
If you are going to be clustering samba, the smbpasswd backend cannot be used.
With the tdbsam and smbpasswd backends, you will first need to create the user account on the system running Samba. For example, if running Samba on Linux, the useradd command can be used to create the user account.
useradd -p itsasecret -d /home/john.doe -s /bin/bash john.doe
Use the smbpasswd -a command to add the user to the Samba database.
~]# smbpasswd -a john.doe
New SMB password:
Retype new SMB password:
Added user john.doe.
The pdbedit --list --smbpasswd-style command can be used to verify the user was added to the SMB database. The output should be indetical to the smb.passwd file.
~]# pdbedit --list --smbpasswd-style
john.doe:1000:XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX:43A29EF878C2498C6960672E21CA9B9D:[U ]:LCT-616C00EF:
~]# cat /etc/samba/smb.passwd
john.doe:1000:XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX:43A29EF878C2498C6960672E21CA9B9D:[U ]:LCT-616C00EF:
The smbclient command can be used to see if you are able to connect to a share with a certain user and their password (john.doe in this example).
smbclient --list //$(hostname -s)/share --user john.doe
Did you find this article helpful?
If so, consider buying me a coffee over at