客户端:
cat /etc/passwd
显示用户 weifeng 500
 
服务端:
vim /etc/exports
/mnt 192.168.1.105(rw,sync,all_squash,anonuid=500,anongid=500)
 
exportfs -arv
 
客户端:
cd
umount -l /opt/
mount -t nfs -onolock,nfsvers=3 192.168.1.16:/mnt /opt
cd /opt/
ls -l
touch 2.txt
显示创建文件用户名 weifeng
 
服务端:
vim /etc/exports
/mnt 192.168.1.105(rw,sync,no_root__squash)
exportfs -arv
客户端:
cd
umount /opt/
mount -t nfs -onolock,nfsvers=3 192.168.1.16:/mnt /opt
cd /opt/
rm -rf ./*
touch 111
ls -l
显示创建文件用户名 root
 
实际配置:
服务端:

[root@pre uploadfiles]# cat /etc/exports
/data/website*******/uploadfiles .*****.(rw,sync,all_squash,anonuid=,anongid=)
/data/website******/media .*****.(rw,sync,all_squash,anonuid=,anongid=)
客户端配置:

cat /etc/rc.local

mount -t nfs 172.17.100.98:/data/w*****/media /data/website*******/media
mount -t nfs 172.17.100.98:/data/webs*uploadfiles /data/website*******/uploadfiles df -h 172.17.100.98:/data/website/********/media
40G .0G 29G % /data/website/******media
172.17.100.98:/data/website/ktv/source/uploadfiles
40G 9.0G 29G 24% /data/website*******/uploadfiles
05-28 07:02