What is Samba
To provide printer and file sharing, Microsoft Windows uses a facility known as SMB (Server Message Block). This same facility is sometimes known as NetBIOS or LanManager. Thanks to Andrew Tridgell and others, Linux systems provide support for SMB via a package known as Samba. Like SMB, Samba lets you:
- Share printers and files among Microsoft Windows, OS/2, Netware, and Unix systems
- Establish a simple nameserver for identifying systems on your local area network
- Backup PC files to a Linux system and restore them
- Administer users and passwords
Samba has proven its reliability and high performance in many organizations.Samba software suite on Enterprise Linux is a collection of programs that implements the Server Message Block (commonly abbreviated as SMB) protocol for UNIX systems.
In Enterprise Linux system, install below packages to get started with Samba. You can download/install these packages from yum server using the “yum install” command.
To install these packages :
If you are using an active directory setup, install below packages as well.
Below are the list of packages which will be installed once you have installed the above packages.
Configuring a Samba share
Samba’s configuration usually resides in /etc/samba/smb.conf which contains all the configuration parameters related to samba. Follow the steps given below to configure a samba share.
1. For the share to be accessible to a particular user, we must first create a user (john) on the linux server where the share resides as well.
2. To add activate the Samba user and set the password, use the “smbpasswd” command with the -a option.
3. Create the directory to share or you can use an existing directory. Also set full permissions on the directory.
4. Next, set the SElinux contexts on the share. Verify if you can create a file in the share.
5. Edit the /etc/samba/smb.conf file and add the share settings.
Restart samba service for the above settings to take effect.
systemctl enable smb
To find out the issue with a samba share, you can try disabling the iptables service and turning off the SELinux. Make sure to enable them back after you resolve the confilct.
Verify samba parameter using testparm
To verify that the parameters are correct in the smb.conf file or to debug configuration problems, use the testparm command.
For debugging problems with Samba in general, the log files log.smbd and log.nmbd under the /var/log/samba directory are invaluable. The parameter log level in the global section of the smb.conf file determines the amount of detailed information Samba writes to the log files, with level 0 being the most general and 10 being the most detailed. Each logging level contains the messages from that level, in addition to the logging messages below it. For example, a logging level of 5 contains messages from level 5, plus those from levels 0 through 4.