Build a Samba Server on Redhat / CentOS

Below shows you the basic steps in order to configure your Linux Redhat / CentOS server as a Samba server.

Install and Configure

yum install samba -y
chkconfig --level 123 smb on
cd /etc/samba
mv smb.conf smb.conf.backup
vi smb.conf
cat > /etc/samba/smb.conf

[paste the text below]

workgroup = Workgroup
netbios name = SambaServerserver string = Samba Server %v
log file = /var/log/samba/log.%m
encrypt passwords = yes
max log size = 50

path = /data
valid users = smbuser
read only = No

Configure Users

adduser smbuser 
passwd smbuser
smbpasswd -a smbuser [enter the same password as your smbuser unix account]

Restart Samba

/etc/init.d/smb restart

Map Drive

You can now map your drive with the windows command prompt using the command :

C:\Users\admin>net use * \\[SAMBA SERVER IP]\data /user:smbuser [password] /PERSISTENT:YES


To see if the share is available you can run the following command :

[root@SambaServer ~]# smbclient -U smbuser -L //[SAMBA SERVER IP]
Domain=[FILESERVER] OS=[Unix] Server=[Samba 3.0.33-3.29.el5_5]

Sharename Type Comment
--------- ---- -------
data Disk
IPC$ IPC IPC Service (Samba Server 3.0.33-3.29.el5_5)
Domain=[FILESERVER] OS=[Unix] Server=[Samba 3.0.33-3.29.el5_5]

About the Author


R Donato

Rick Donato is the Founder and Chief Editor of He currently works as a Principal Network Security Engineer and has a keen interest in automation and the cloud.

You can find Rick on Twitter @f3lix001