NFS: Provide network shares to specific clients
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
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
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
Provide network shares suitable for group collaboration
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
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