[a] First add Linux/UNIX user using useradd/adduser command.
[b] Then use same user name to add to Samba share using smbpasswd command.
NOTE: Unlike Samba 3, Samba 4 does not require a local Unix user for each Samba user that is created. Please see this note for more info.
Step # 1: Add a user joe to UNIX/Linux system
adduser command adds user to the system according to command line options and configuration information in /etc/adduser.conf. They are friendlier front ends to the low level tools like useradd.
Type any one of the following command:
# useradd joe
# passwd joe
Step # 2: Add a user to samba
Now user joe has account on Linux/UNIX box. Use smbpasswd command to specifies that the username following should be added to the local smbpasswd file:
# smbpasswd -a joe
Step # 3: Add a user to a Samba share
By default user gets access to /home/joe from windows system. Let us say you want to give joe access to /data/accounts (make sure directory /data/accounts exists) directory. Open /etc/samba/smb.conf file and add/modify share called [accounts]:
[accounts] comment = Accounts data directory path = /data/accounts valid users = vivek raj joe public = no writable = yes
Save the file.
Step #4: Restart the samba
# service smb restart
# /etc/init.d/smb reload
Unlike Samba version 3.x and earlier, Samba version 4.x does not require a local Unix/Linux user for each Samba user that is created. The command is as follows for adding users into Samba Active Directory:
# /usr/local/samba/bin/samba-tool user add USERNAME-HERE
# samba-tool user add USERNAME-HERE
Please see Samba AD DC howto for more info.
See also:Tweet itFacebook itG+ itDownload PDF versionFound an error/typo on this page?
- 30 Cool Open Source Software I Discovered in 2013
- 30 Handy Bash Shell Aliases For Linux / Unix / Mac OS X
- Top 30 Nmap Command Examples For Sys/Network Admins
- 25 PHP Security Best Practices For Sys Admins
- 20 Linux System Monitoring Tools Every SysAdmin Should Know
- 20 Linux Server Hardening Security Tips
- Linux: 20 Iptables Examples For New SysAdmins
- Top 20 OpenSSH Server Best Security Practices
- Top 20 Nginx WebServer Best Security Practices
- 20 Examples: Make Sure Unix / Linux Configuration Files Are Free From Syntax Errors
- 15 Greatest Open Source Terminal Applications Of 2012
- My 10 UNIX Command Line Mistakes
- Top 10 Open Source Web-Based Project Management Software
- Top 5 Email Client For Linux, Mac OS X, and Windows Users
- The Novice Guide To Buying A Linux Laptop