SAMBA part 1

IPConfig
eth1 : 192.168.0.11

#yum install samba*  -y

if you need to share system created directory(let selinux allow you to write )
setsebool   -P   samba_export_all_ro   on

setsebool   -P  samba_export_all_rw   on
 if -P option is given- the value of policy is persistent after reboot , if not then its value is changed temporarily till reboot.
To share home directory of users:-
setsebool   -P   samba_enable_home_dirs   on

To share the folder you have created you must do :-
eg. /myshare , /public/disk1 etc

#chcon   -t   samba_share_t   /myshare
#chcon   -t   samba_share_t  /public/disk1
                //check the selinux status by running "ls -lDZ" for dir and "ls -lZ" for files
In above fig. check the selinux context of Screenshot.png which I drag and dropped from Desktop of root to /pub_drive  directory and when i tried to share.. it failed.the reason was the mis labled selinux context   after changing it  the share was successful. look below:-


Sample  Example :
share a directory /pub_drive which is readable to everyone but writable/readable to the "test1" group.

#vim  /etc/samba/smb.conf
//edit around line 70+
 workgroup = WORKGROUP
server string = ...  //you can leave default
deadtime = 15  //this is optional ,it will treat 15 minutes idle time connection as dead
 netbiosname = sambasamba  // you can put any name,this name can also be used to connect by win clients.
host allow = 192.168.0.  198.167.89.  //here only /24 network of two subnet will be allow to access
invalid user = admin_user   root
max connection = 20  //connections up to 20 is enabled
security = user  //username and its password will be asked
//at end of file or share section
[pub_drive]    //you can give other names
path = /pub_drive
comment = everyone read but test1 gorup write
browseable = yes
writeable = yes
writelist = +test1
printable = no  //optional .it disable to load priint drivers
guestok = no

save/exit

service smb start
check file/dir permissions and make sure /pub_drive is in ownership of group test1 and writeable
eg.
chown  root.test1  /pub_drive/
chmod  775  /pub_drive/
Settingup users
#smbpasswd  -a   ganesh
password: ***********
#usermod -G test1 ganesh

Allow samba and samba client through firewall

Logon into a Windows xp/Vista/7 machine go to run type your samba serveraddress 
\\192.168.0.11
type your username and password....success!!

Check and delete connections (useful for deleting session in cache)
net use              ////to check the session
net use   \\192.168.0.11\IPC$ /delete            ///to delete
eg.

No comments:

Post a Comment