Wednesday, December 18, 2013

How to Configure Samba Server

Hello... Friends today we are going to discus about Samba server , Samba is an open source implementation of SMB file sharing protocol that provides file and print service to SMB/CIFS clients. Samba  allows a non-windows server to communicate with the same networking protocol as the windows products.



Step 1 : First of all Install samba package as # yum install samba-* -y 



Now configure samba server so that we can configure it for auto start

# chkconfig smb on
# chkconfig nmb on

if we discus about these services Demon
smbd : this service provides printer sharing services
nmbd : this service provides NetBIOS-to-IP-address name service
NetBIOS over TCP/IP requires some method for mapping NetBIOS computer named to the IP address of a TCP/IP network.

Step 2 : change SELinux configuration from enforcing to disable

# vi /etc/selinux/selinux


now save it

Step 3 : open the port in iptables rule :

Basically Samba server use these port :

137
138
139
445
here we are using only port 137,138,139 so add these ports in iptables as shown


save iptables rules & Restart the iptables service

# service iptables save
# service iptables restart

Step 4 : Next add a user to use this service i am here using user "nullsmba" who use  this service



# useradd nullsmba 
# smbpasswd -a nullsmb

make a directory with name share

# mkdir /share
# chown -R 0755 /share

Step 5: Next backup conf files & edit the config file

# cp /etc/samba/smb.conf  /etc/samba/smb.conf.bak
# vi /etc/samba/smb.conf



Now add share portion for smb in the config file

  [share]
      path = /share
      public = no
     writable = yes
     printable = no
     browseable = yes
     valid user = nullsmb
     hosts allow = 192.168.56.0/24

save the file & start the smb & nmb services

# service smb start
# service nmb start

Step 6 : Next let's test the service is running ok or not

# testparm


yeah it Runs properly now let's connect remotely in the network share this service

Step 7 : Let's connect shared folder Remotely 

for window xp :


just go to start >right click on my network place >map network Drive > assign letter then click on finish button > Give username & password



here is the drive shared by Samba server

here i am adding these two files so that we can test that we are able to share files remotely using samba server

here is both files in our server machine too

for Linux : 

just in terminal type smbclient //server-ip/shared-folder -U username



No comments:

Post a Comment