Samba is free software mainly used for file sharing between other platforms (Windows) using SMB/CIFS protocol. Samba uses TCP/IP protocol. Samba provide file and print sharing service between Linux and Window system. Samba allows Linux to interact with Window client, Server, member of Active Directory, Primary domain controller, or member server. Samba Web Administration tool (SWAT) is a GUI base configuration tool for Samba Serveravailable from RHEL 6.
* Microsoft window use Common Internet File System (CIFS) protocol for networking.
* CIFS was developed from Server Message Block (SMB) protocol.
Linux SAMBA provides the following services => User Authentication and authorization, File and printer sharing, Name resolution, Browsing.
smb => (SMB/CIFS Server) Main samba service which provides user authentication and authorization & file and printer sharing.
nmb => (NetBIOS name server) Resource browsing.
Step 1 - Check the Server IP-Address and OS Details.
Step 2 - Update yum repositories and packages.
Step 3 - Install samba packages along with dependencies using yum.
Step 4 - Create a user and set the samba password for accessing the share folder.
Step 5 - Create a new folder for using the share access and change the ownership for the share folder.
Step 6 - Before changing the configuration file, backup the smb.conf.
Step 7 - Now we want to edit the configuration file and our share folder structure in smb.conf.
[root@proxy ~]# vim /etc/samba/smb.conf
Note : You can see the share sections. Here by default home folders of the user will be displayed . You can comment the unwanted section using “;” symbol .
Step 8 - After changing the settings, restart the samba service and also enable start samba service automatically while booting.
Step 9 - You can check your configuration by using testparm command
Step 10 - Now you can access the share folder on windows machine by typing \\samba-server-ip\ on run prompt . You can see the share folder after entering the username and password.
Here, I have created a file and folder for testing the permission.
Step 11 - Here I need to share my Apache document root " /var/www/html/", I have to do these steps.
Set the samba user permission on document root and restart the samba service.
Check the share folder and create test file for checking permissions.
Step 12 - Try to list share from Samba server with the user.
Step 13 - How to allow Samba in iptables and disable selinux.
SAMBA uses ports 137,138,139 and 445
Port 137 UDP NetBIOS name service (WINS)
Port 138 UDP NetBIOS datagram
Port 139 TCP NetBIOS Session (TCP), Windows File and Printer Sharing
Port 445 Microsoft-DS Active Directory, Windows shares (TCP)
Port 445 Microsoft-DS SMB file sharing (UDP)
To open firewall for Samba adds the following rules and restart the iptables.
#iptables -A INPUT -m state --state NEW -m udp -p udp --dport 137 -j ACCEPT
#iptables -A INPUT -m state --state NEW -m udp -p udp --dport 138 -j ACCEPT
#iptables -A INPUT -m state --state NEW -m tcp -p tcp --dport 139 -j ACCEPT
#iptables -A INPUT -m state --state NEW -m tcp -p tcp --dport 445 -j ACCEPT