Network File System Sharing is used for sharing the files/directory all through the network
port 2049
files used are
rpc.nfsd
rpc.mountd
rpc.lockd
rpc.statd
rpc.rquotandd
@ /usr/sbin
/etc/init.d/nfs
/etc/init.d/nfslock
/etc/exports
1.Server --- place from which we need to share the directory
---->yum install -y nfs-utils*
---->service nfs restart
---->chkconfig nfs on
---->vim /etc/exports
In this file we say about files we need to share ,the mode in which the files are to shared and network to which the files are to be shared
eg:
/nfs 192.168.0.0/24(ro)
/nfs 192.168.122.0/255.255.255.0(rw,sync)
/nfs 192.168.122.0/24(ro)
some of the modes in which directories can be shared are
crossmnt
no_subtree_check
root_squarch
---->exportfs -r
----****we should set the proper context ,sebool and setfacl for needed user
---->getsebool -a | grep nfs
this will list the needed Boolean we must set it according to the needs
---->setfacl -m u:nfsnobody:rwx /nfs
this will allow the nfsnobody user to use the /nfs directory this is needed if we are giving the write option to the directory
if more problems occur while sharing the directory we should also check the context for selinux or disable the selinux
showmount -e 192.168.0.1
will list the all the nfs shared directory by the server 192.168.0.1
2.Client --- where we will mount the shared directories
there are multiple ways to mount the directory
---->yum install -y nfs*
---->service nfs restart
---->chkconfig nfs on
a.every shared folders will be available at /net every time as readonly type we use that as following ,for first example of sharing
---->cd /net
---->cd 192.168.0.1 cd nfs
b.We can also mount the directory by simple mount command
mount nfs://192.168.0.1/nfs /data
one of the main default of this system is that if we give the entry for mount in fstab and server goes down and if we restart the client ,the client will have boot break to over come this problem we use autofs mounting systems
c.using autofs mounting system
here first we will edit /etc/auto.master file
---->vim /etc/auto.master
/data /etc/auto.nfs
---->vim /etc/auto.nfs
nfs -rw 192.168.122.1:/nfs
----->service autofs reload
----->chkconfig autofs on
here after reloading the autofs service we could browse to that folder
---->cd /data
---->cd nfs
---->ls
Saturday, October 6, 2012
Samba Sharing
Samba sharing use for sharing between linux and windows machines
port 137,139,138,445
configuration file /etc/samba/smb.conf
samba sharing can be of two types public and non public with username and passwd
1.public sharing
vim /etc/samba/smb.conf
74 workgroup = MYGROUP
75 server string = Samba Server Version %v
79 interfaces = lo eth0 192.168.12.2/24 192.168.13.2/24
80 hosts allow = 127. 192.168.12. 192.168.13.
last 8 lines
[public]
comment = Public Stuff
path = /smb
public = yes
writable = yes
printable = no
write list = +staff
browseable = no
here work group must be capital
server string is the name by which we select the sambaserver
interfaces as per needed
hosts allowed as per needed
later the share name in square bracket its the name by which we select the samba share from the server
path path to the directory
public yes for the public connection
browseable yes to enable browsing
here we are sharing the /smb directory,we should set the context,sebool and setfacl as need
---->chcon -t samba_share_t /smb
---->setfacl -m u:nobody:rwx /smb
and give needed sebool
getsebool -a | grep smb
getsebool -a | grep samba
2.Non public sharing
for a non public sharing the public tag should be no and we should add following tags from lines 252 to last part
valid users = ram
and we need to setfacl for ram to the directory /smb
---->setfacl -m u:ram:rwx /smb
and we need to give smbpasswd
smbpasswd -a ram
smbpasswd -e ram
-a for adding the user to samba users and -e to enable the samba passwd
we could see the hosted samba server by
smbclient -L 192.168.122.1 <---------IP of server
client part
1.public
smbclient -L 192.168.122.1
smbclient //server_string/sharename
2.Non public users
smbclient //server_string/sharename -U username
port 137,139,138,445
configuration file /etc/samba/smb.conf
samba sharing can be of two types public and non public with username and passwd
1.public sharing
vim /etc/samba/smb.conf
74 workgroup = MYGROUP
75 server string = Samba Server Version %v
79 interfaces = lo eth0 192.168.12.2/24 192.168.13.2/24
80 hosts allow = 127. 192.168.12. 192.168.13.
last 8 lines
[public]
comment = Public Stuff
path = /smb
public = yes
writable = yes
printable = no
write list = +staff
browseable = no
here work group must be capital
server string is the name by which we select the sambaserver
interfaces as per needed
hosts allowed as per needed
later the share name in square bracket its the name by which we select the samba share from the server
path path to the directory
public yes for the public connection
browseable yes to enable browsing
here we are sharing the /smb directory,we should set the context,sebool and setfacl as need
---->chcon -t samba_share_t /smb
---->setfacl -m u:nobody:rwx /smb
and give needed sebool
getsebool -a | grep smb
getsebool -a | grep samba
2.Non public sharing
for a non public sharing the public tag should be no and we should add following tags from lines 252 to last part
valid users = ram
and we need to setfacl for ram to the directory /smb
---->setfacl -m u:ram:rwx /smb
and we need to give smbpasswd
smbpasswd -a ram
smbpasswd -e ram
-a for adding the user to samba users and -e to enable the samba passwd
we could see the hosted samba server by
smbclient -L 192.168.122.1 <---------IP of server
client part
1.public
smbclient -L 192.168.122.1
smbclient //server_string/sharename
2.Non public users
smbclient //server_string/sharename -U username
FTP sharing
File Sharing Protocol
ports used
ftp-data 20/tcp
ftp-data 20/udp
ftp 21/tcp
ftp 21/udp
files are /etc/vsftpd/vsftpd.conf
We have two type of access modes anonymous and user mode
In anonymous we can enter without password & in user mode we should enter password to get access
In anonymous we mode we will be sharing /var/ftp/pub directory & in usermode we will be sharing coresponding users home directory
In anonymous mode users will normally have only read permission if we need to give write permission we need to create a directory inside the /var/ftp and change the context to public_content_rw_t and set the acl of that directory to ftp user to enable anonymous user entry we need to enable following lines as yes
anonymous_enable=YES
write_enable=YES anon_upload_enable=YES
anon_mkdir_write_enable=YES
give the write permission as per need we need to set the sebool also to get it right
getseboot-a | grep ftp
To enable user mode entry just set no to all the anonymous settings and set yes to
local_enable=YES and we need to set needed sebool getsebool -a | grep ftp
ports used
ftp-data 20/tcp
ftp-data 20/udp
ftp 21/tcp
ftp 21/udp
files are /etc/vsftpd/vsftpd.conf
We have two type of access modes anonymous and user mode
In anonymous we can enter without password & in user mode we should enter password to get access
In anonymous we mode we will be sharing /var/ftp/pub directory & in usermode we will be sharing coresponding users home directory
In anonymous mode users will normally have only read permission if we need to give write permission we need to create a directory inside the /var/ftp and change the context to public_content_rw_t and set the acl of that directory to ftp user to enable anonymous user entry we need to enable following lines as yes
anonymous_enable=YES
write_enable=YES anon_upload_enable=YES
anon_mkdir_write_enable=YES
give the write permission as per need we need to set the sebool also to get it right
getseboot-a | grep ftp
To enable user mode entry just set no to all the anonymous settings and set yes to
local_enable=YES and we need to set needed sebool getsebool -a | grep ftp
Subscribe to:
Posts (Atom)