Linux Reference4.4 NFS Server |
20.02.2008 |
| ← 4.3 Samba (File Server) | [ up ] - [ top ] - [ linux a-z ] | 4.5 Messaging, E-Mail → |
Up to Fedora Core 2
For NFS'ing on Fedora Core 5 please scroll down.
NFS Server (e.g. 192.168.1.33):
nfs-export --perm "rw" --dir /var/www/html/tmp/iword --ip 192.168.1.34Client:
mount -t nfs 192.168.1.33:/var/www/html/tmp/iword /var/www/html/tmp/iword mount -t nfs -o "rw" 192.168.1.33:/var/www/html/tmp/iword /var/www/html/tmp/iword
iptables
# NFS (111): -A RH-Firewall-1-INPUT -m state --state NEW -m tcp -p tcp --dport 111 -j ACCEPT -A RH-Firewall-1-INPUT -m state --state NEW -m tcp -p tcp --dport 715 -j ACCEPT -A RH-Firewall-1-INPUT -m state --state NEW -m tcp -p tcp --dport 2049 -j ACCEPT -A RH-Firewall-1-INPUT -p udp -m udp --dport 111 -j ACCEPT -A RH-Firewall-1-INPUT -p udp -m udp --dport 715 -j ACCEPT -A RH-Firewall-1-INPUT -p udp -m udp --dport 2049 -j ACCEPTIn NFS world, the root account does NOT get mapped to UID 0 on the NFS server but to "0-2" (a number pretty close to 65533 (or 4294967294) if memory serves me well) so even if you're operating as root on the client machine you won't be able to access files which don't have specific read/write permissions.
chgrp 4294967294 .
Fedora Core 5
Note: I didn't find the nfs-export command anymore even if the rpm's system-config-nfs, nfs-utils-lib and nfs-utils are all installed. So first of all I started a GUI utility with command system-config-nfs on a X session to create another NFS export by clicking on buttons but I tried to find a solution where I could do this at a command line again.
Server that hosts the files
# cat /etc/exports# Comments are allowed here /tmp/pub (ro,insecure,all_squash) /home/reto (rw,all_squash,anonuid=500,anongid=500)→ anonuid=500,anongid=500 means uid 500 and gid 500 will be used as user and group id when write processes are made on this host. See man exports for a complete list and explanation of all options.
Then, (re)start nfsd/etc/init.d/nfs restartOn "client server" thats mounts the previously exported share
(As root)mkdir /tmp/reto mount -t nfs 192.168.1.34:/home/reto /tmp/reto
copyright by retoh - created with mytexi