SAMBA(SMB server) is a file sharing server. Which is used to share files between Windows, Linux and Unix Systems. SMB(Server Message Block) is a proprietary protocol which is developed by Microsoft
This article explains how to install and configure SAMBA in Linux.
Step 1: Create a directory where you want to keep data and share with other remote systems(either windows/Linux/UNIX).
Step 2 : Installing Samba server
#yum install samba*
Step 3 : Now we have to configure the samba server. Edit the main configuration file (/etc/samba/smb.conf)
specify the work group where this server belongs
search for workgroup word and specify your work group name
workgroup = SALES-DEPT.
Why we require this workgroup?
When windows user try to access any network resource they first try to access my network places and then search for workgroup then to server. So definitly we have to specify this workgroup entry in smb.conf file.
Now we have to give a name to this samba server, search for "server string" with out quotes then provide the samba server name (here that name is sales-share)
server string = sales-share
Now specify the share details, which folder you want to share. To whom you want to share? Goto last line of the smb.conf file specify your shared folder details as follows.
comment = "This is the Sales data which is shared with my windows users"
path = /sales
valid users = user1 user2
writable = no
privatable = no
After giving this seven entries just save and exit the file.
Let me explain each and every thing what we used here.
a.[sales-dir] -- This is the share name, so when ever any user accessed the samba server through network this will be visible as folder shared.
b.comment -- This is just a comment, which will help to know what is this share for.
c.path -- This is used to specify which folder on my samba machine to share.
d.valid users -- This will specifies which user is having access on this folder.
e.writable -- This will specify whether users are able to write or not, In this example the can just read the folder and copy.
f.Privatable -- This will indicate whether this folder is private or not.
g.browsable -- This is used to specify whether the folder content is browsable or not.
You can specify the Read-Only and Write Access to specified using keywords "read only" and "write list"
example: write list = user1, user3
read only = user2, user4
Step 4 : Now create passwords for the users who are going to access this samba share remotely.
#smbpasswd -a user1
#smbpasswd -a user2
generate the passwords for this two users and this passwords will be stored in /etc/samba/smbpasswd
Step 5 : check for the syntax for your smb.conf file if in case you did any mistake
Step 6 : Restart the samba service
#service smb restart
Step 7 : Permanently on the smb service, So that after rebooting the system too our server will start running.
#chkconfig smb on
step 8: change the selinux security context for the shared folder
#chcon -Rt samba_share_t /sales
Thats all. You have done configuring the samba server.