NFS Flashcards
1
Q
NFS: Provide network shares to specific clients
A
Provide network shares to specific clients.
1. Install the NFS packages: # yum groupinstall -y "NFS file server"
2. Add new rules to the firewall: # iptables -I INPUT -m state --state NEW -m udp -p udp --dport 111 -j ACCEPT # iptables -I INPUT -m state --state NEW -m tcp -p tcp --dport 111 -j ACCEPT # iptables -I INPUT -m state --state NEW -m tcp -p tcp --dport 2049 -j ACCEPT
3. Save the firewall configuration: # service iptables save
- Configure SELinux to support the service
getsebool -a | grep nfs
5. Activate the NFS services at boot: # chkconfig rpcbind on # chkconfig nfs on # chkconfig nfslock on
6. Start the NFS services: # service rpcbind start # service nfs start # service nfslock start
7. Create directories to export and assign access rights: # mkdir -p /home/tools # chmod 777 /home/tools # mkdir -p /home/guests # chmod 777 /home/guests
- Edit the /etc/exports file and add the following lines with the name (or IP address) of the client(s):
/home/tools client1(rw,no_root_squash)
/home/guests client2(rw,no_root_squash)
Note: Please, don’t put any space before the open parenthesis, this would completely change the meaning of the line!
9. Export the directories: # exportfs -avr
Note: On the client side, the commands are: # yum install -y nfs-utils # mount -t nfs server:/home/tools /mnt
2
Q
Provide network shares suitable for group collaboration
A
Provide network shares suitable for group collaboration.
1. Install the NFS packages: # yum groupinstall -y "NFS file server"
2. Add new rules to the firewall: # iptables -I INPUT -m state --state NEW -m udp -p udp --dport 111 -j ACCEPT # iptables -I INPUT -m state --state NEW -m tcp -p tcp --dport 111 -j ACCEPT # iptables -I INPUT -m state --state NEW -m tcp -p tcp --dport 2049 -j ACCEPT
3. Save the firewall configuration: # service iptables save
- Configure SELinux to support the service
getsebool -a | grep nfs
5. Activate the NFS services at boot: # chkconfig rpcbind on # chkconfig nfs on # chkconfig nfslock on
6. Start the NFS services: # service rpcbind start # service nfs start # service nfslock start
7. Create a directory to export: # mkdir /shared
8. Create a dedicated group: # groupadd -g 60000 sharedgrp
9. Assign this group to the new directory: # chgrp sharedgrp /shared
10. Define permissions: # chmod 2770 /shared
- Edit the /etc/exports file and add the following lines with the name (or IP address) of the client(s):
/shared client(rw,no_root_squash) - Export the directories:
# exportfs -avr
Note: the client needs to have access to the same group (via LDAP) and be a member of this group.