What is SAMBA?
A Samba is support for SMB (Server Message Block) via a package which is provided by Linux system. It is open source software which uses TCP/IP protocol. It provide printer and file sharing facility uses by Microsoft windows which is known as SMB. Samba can provide:
- Share printers and files with Microsoft Windows, OS/2, Netware, and UNIX systems.
- It can establish a simple name server for identifying systems on your local area network.
- It can help backup PC files to a Linux system and restore them for future use.
- It can also provide Administer users and passwords.
INSTALLATION OF SAMBA
Before installing Samba we have to install some packages in Enterprise Linux system. We can also download/install packages form YUM server by using“yum install” command.
- samba #### basic Samba packages
- samba-client #### samba client
For installing all the required packages:
- # yum install samba
- # yum install samba-client
Suppose you have an active directory setup for using it, install below packages also.
- # yum install samba-winbind
- # yum install samba-winbind-clients
- # yum install samba-winbind-krb5-locator
Below are the lists of all the packages which will be-installed once you have installed the above packages.
CONFIGURATION OF SAMBA
The configuration of Samba is generally comes under the path/etc/samba/smb.conf which contains all the configuration parameters related to samba. Here we provide some basic steps to configure a samba share.
For the share to be accessible to a particular user, we must first create a user (XXXX) on the Linux server where the share resides as well.
- # user_add XXXX
- # password XXXX
Changing the password of user XXXX.
Retype new password:
password: all authentication tokens updated successfully.
To add activate the Samba user and set the password, use the “smbpasswd” command with the -a option.
- # smbpassword -a XXXX
For sharing information create the directory or we can use an existing directory. Also set full permissions on the directory.
- # mkdir -p /path/to/share
- # chmod -R 777 /path/to/share
Next step is to set the SElinux contexts on the share. Verify if you can create a file in the share.
- # chcon -R -t samba_share_t /path/to/share
- # cd /path/to/share
- # echo test > testfile.txt
Edit the /etc/samba/smb.conf file and add the share settings.
- # vi /etc/samba/smb.conf
path = /path/to/share
comment = samba share for john
public = yes
writable = yes
create mask = 0777
browseable = yes
Now we have to verify current Samba setting by running the below command:
- # testparm
Load smb config files from /etc/samba/smb.conf
rlimit_max: increasing rlimit_max (1024) to minimum Windows limit (16384)
Processing section “[homes]”
Processing section “[printers]”
Processing section “[print$]”
Processing section “[Anonymous]”
Loaded services file OK.
Server role: ROLE_STANDALONE
Press enter to see a dump of your service definitions
# Global parameters
netbios name = centos
printcap name = cups
security = USER
idmap config * : backend = tdb
cups options = raw
comment = Home Directories
browseable = No
inherit acls = Yes
read only = No
valid users = %S %D%w%S
comment = All Printers
path = /var/tmp
browseable = No
printable = Yes
create mask = 0600
comment = Printer Drivers
path = /var/lib/samba/drivers
create mask = 0664
directory mask = 0775
write list = root
comment = Anonymous File Server Share
path = /srv/samba/anonymous
force user = nobody
guest ok = Yes
read only = No
Restart the whole samba services for the above settings to take effect.
- # service smb restart