sudo apt-get install nfs-kernel-server
vi /etc/hosts.deny
#在文件中增加内容
###NFSDAEMONS
portmap:ALL
lockd:ALL
mountd:ALL
rquotad:ALL
statd:ALL
vi /etc/hosts.allow
#在文件中增加内容
###NFSDAEMONS
portmap:客户端IP
lockd:客户端IP
rquotad:客户端IP
mountd:客户端IP
statd:客户端IP
/etc/init.d/portmap restart
若将192.168.71.205的/home目录共享给192.168.71.46,在/etc/exports文件中添加
/home 192.168.71.46(rw,sync,no_root_squash)
说明:
(1)rw是读写权限,只读为ro;
(2)sync数据同步写入内存和硬盘,async数据会先暂存在内存,而不立即写入硬盘;
(3)no_root_squash服务器共享目录用户的属性,如果用户是root,那么对于这个共享目录来说就具有root的权限/etc/init.d/nfs-kernel-serverrestart
sudo apt-get install nfs-common
如:将192.168.71.205 NFS服务端的/home/挂载到192.168.71.46的NFS客户端上,在192.168.71.46机器上执行:
mount-t nfs -o tcp,soft,intr,timeo=50,retrans=12, 192.168.71.205:/home /home/testclient(这两个目录必须是两台机器上已存在的)。
df
unmount /home/testclient