nfs小记

1.服务端配置
vi /etc/exports
/hello 192.168.10.2(ro)
service portmap start
service nfs start
showmount -e   //查看服务器本机的共享内容
mkdir /hello
touch /hello/test.txt     //测试
2.客户端配置
service portmap start
showmount -e 192.168.10.1   //查看192.168.10.1服务器的共享内容
moun -t nfs -o soft 192.168.10.1:/hello /mnt    //将服务器的/hello目录挂载到本机的/mnt目录上
3.在客户机上访问
vi /mnt/test.txt     //由于在服务器上设定的是只读ro,所以这里只能查看
如果想要在客户端编辑需修改服务器的/etc/exports
vi /etc/exports
/hello 192.168.10.2(rw)
chmod 757 /hello/test.txt    //修改文件权限
exportfs -rv    //重新mount使配置生效

你可能感兴趣的:(nfs)