Sunday, 9 September 2018

How to add a samba user in Centos 7



To allow access in samba share directory, first need to create a local/OS user account (If already not exist) and then create a samba password for the same account for samba user.

Add an OS user account:

Run the following command to add an OS user account:

[root@linuxcnf ~]# useradd linuxcnf

Run the following command to password for the created user:

[root@linuxcnf ~]# passwd linuxcnf

Run the following command to add an OS user account in Samba:

[root@linuxcnf ~]# smbpasswd -a linuxcnf
New SMB password:
Retype new SMB password:

Provide access on samba share directory to the user:

Append the user as below in samba configuration file /etc/samba/smb.conf to access the share directory:

[root@linuxcnf ~]# vi /etc/samba/smb.conf
[admin]
   comment = Apache Root Directory
   path = /var/www/html
   valid users = linuxcnf
   public = no
   writable = yes

Reload the samba service to refresh the configuration:

[root@linuxcnf ~]# service smb reload

It’s done!!!

No comments:

Post a Comment