Adding a Samba User

Adding a Samba User

To add a samba user follow these steps:

[a] First, add Linux/UNIX user using the standard useradd/adduser command.

[b] Then, use same user name to add to Samba share using smbpasswd command.

Step # 1: Add a user “joe” to UNIX/Linux system

command adds user to the system according to command line options
and configuration information in /etc/adduser.conf.

Type any one of the following command:
# useradd joe
# passwd joe

adduser joe

Step # 2: Add a user to samba

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

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]:

comment = Accounts data directory
path = /data/accounts
valid users = vivek raj joe
public = no
writable = yes

Save the file.

Step #4: Restart samba

The way in which you restart samba is, of course, distro and system specific. Typically, you’ll restart samba with a command like:

# service smb restart
# /etc/init.d/smb reload
# /usr/local/sbin/smb restart
# /usr/sbin/smb restart

About: admin