Samba Server

Samba is a free software re-implementation of the Common Internet File System (CIFS, also know as SMB) protocol. Microsoft clients will use this protocol to access files and printers located on your Linux/Unix server just as if it were a native windows server.

Samba allows file and print sharing between computers running Microsoft Windows and computers running Unix.

Configuring SAMBA server

Step 1 : Install SAMBA package

Download samba packages and install by using following command.

# yum install samba* -y

Step 2: Once installation completed, make directory and assign full permissions to it.

# mkdir /samba_share

# chmod 777 /samba_share

Step 3: Check the context of the directory and change it to according to samba

# ls -ldZ /samba_share

drwxrwxrwx. root root unconfined_u:object_r:default_t:s0 /samba_share/

# chcon -t samba_share_t /samba_share/

# ls -ldZ /samba_share/
drwxrwxrwx. root root unconfined_u:object_r:samba_share_t:s0 /samba_share/

Step 4: Create a user or use existing use who will be allowed to login in as samba use.

# smbpasswd -a smbuser
New SMB password:
Retype new SMB password:
Added user smbuser.

To delete a use from samba, use smbpasswd -x username

To check all the samba users

# pdbedit -L

Step 5 : Open configuration file (/etc/samba/smb.conf) and the following lines.

comment = Public Stuff
path = /samba_share
public = no
valid users = smbuser
writable = yes
printable = no
hosts allow = 192.168.1.

hosts allow – Network range or host range

Step 6: Test the samba parameters.

# 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 "[smbhare]"
Loaded services file OK.
Press enter to see a dump of your service definitions

 comment = All Printers
 path = /var/spool/samba
 printable = Yes
 print ok = Yes
 browseable = No

 comment = Public Stuff
 path = /samba_share
 valid users = smbuser
 read only = No
 hosts allow = 192.168.1.

Step 6: Restart the Samba service with the commands service smb restart and service nmb restart.

# service smb restart

# chkconfig smb on

# service nmb restart

# chkconfig nmb on

Windows as client:

To connect samba server, right click on my computer and select Map Network Drive.

Give the address of the samba server as above and click on Finish button to continue.

When properly configured, it will prompt for username and password and you can see the files and you can add the files to samba server.