So in this documentation we are going to share a folder named /data over network using samba server .The best thing about samba server is we can access samba shares in any Windows OS like Windows XP,Vista,Windows 7 etc.
Steps to configure Samba Server :-
mkdir /data- Samba Server also supports User based Authentication and Host Based Restrictions .
- Samba Server is also restricted by Selinux enforcing mode.So guys keep in mind to change the Selinux Context of File or Directories.
Steps to configure Samba Server :-
- yum -y install samba* (command to install samba server packages )
- Now create /data directory if not already created in your system.
- Now as Selinux is in enforcing mode so please change the context of /data directory.Guys its not recommended to disable or make selinux permissive .So work in enforcing mode and change the context as follows.
- Now edit /etc/samba/smb.conf
workgroup = MYGROUP (MYGROUP is the name of workgroup we want to define )
Now we need to define interfaces of server machine which are allow to receive client queries. For example on server pc if we have two interfaces named eth0 and eth1 but we want to have samba share request only on eth0 so we can do that using interfaces option in smb.conf file as below.
interfaces = lo eth0
Now we need to define share folder we need to share across network.
{myshare} >>> this is the share name of folder.
comment = my share folder >>> any description
path = /data
writable = yes >> writable option is use to give write permission if writable is yes than user will have read and write permission otherwise user will have read permissions only.
valid users = user1 >>> user1 is allow to access this share folder accross network.
browseable = yes >>> this option will make this folder visible when user list all share folders.
Now save and quit this file.
Now as we have define user1 for samba share so we need to create this user and also need to define samba password for this user.
useradd user1
smbpasswd -a user1 >> command to define samba password.
-a option is use to to add user in the samba user's catalog.
Now finally start samba daemons to apply changes :
service smb restart
chkconfig smb on