How to Create SAMBA Server

“Samba is an Open Source/Free Software suite that provides seamless file and print services to SMB/CIFS clients.” Samba is freely available, unlike other SMB/CIFS implementations, and allows for interoperability between Linux/Unix servers and Windows-based clients.

By Default Port # 139

Step 1: Installation

Install the required packages in order to install samba server

# yum install samba samba-client samba-common

Step 2: Configuration

Now to configure samba edit the file /etc/samba/smb.cnf before making changes I will make the backup of original file as /etc/samba/smb.cnf.bak

# mv /etc/samba/smb.cnf /etc/samba/smb.cnf-bk

Now edit the /etc/samba/smb.cnf file.

# vi /etc/samba/smb.cnf

[global]
workgroup = WORKGROUP
server string = Samba Server %v
netbios name = centos
security = user
map to guest = bad user
dns proxy = no
#============================ Share Definitions ============================== 
[Anonymous]
path = /samba/folder
browsable =yes
writable = yes
guest ok = yes
read only = no

Step 3: Create SMB User

Use the following command to add a new Samba user:

# smbpasswd -a username

Step 4: Create SAMBA Group

To create SAMBA group:

# groupadd smbusers
# chown smbusers:smbusers /smbfolder
# usermod -G smbusers user

Create Directory /samba/folder using mkdir command:

# mkdir -p /samba/folder/

Give the permissions to /samba/folder/ directory

#chmod -R 0777 /samba/folder/

Step 5: Start SAMBA Service

Restart the smb service

# service smb restart
# service nmb restart

To Enable smb in multi-user levels.

# chkconfig smb on
# chkconfig nmb on