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]

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

[data]
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

Troubleshooting

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

[root@SambaServer ~]# smbclient -U smbuser -L //[SAMBA SERVER IP]
Password:
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]
Rick Donato

Want to become a Linux expert?

Here is our hand-picked selection of the best courses you can find online:
Linux Mastery course
Linux Administration Bootcamp
and our recommended certification practice exams:
AlphaPrep Practice Tests - Free Trial