版权声明:本文为博主原创文章,未经博主允许不得转载。 https://blog.csdn.net/ggxyx123/article/details/84998670
安装nfs服务:
sudo apt-get install nfs-kernel-server nfs-common
配置nfs:
vim /etc/exports
1 # /etc/exports: the access control list for filesystems which may be exported
2 # to NFS clients. See exports(5).
3 # Example for NFSv2 and NFSv3:
4 # /srv/homes hostname1(rw,sync,no_subtree_check) hostname2(ro,sync,no_subtree_check)
5 # Example for NFSv4:
6 # /srv/nfs4 gss/krb5i(rw,sync,fsid=0,crossmnt,no_subtree_check)
7 # /srv/nfs4/homes gss/krb5i(rw,sync,no_subtree_check)
8 #
添加:
/home/flnet/kernel/tmp/tmp *(rw,sync,no_subtree_check)
rw:读/写权限,只读权限的参数为ro;
sync:数据同步写入内存和硬盘,也可以使用async,此时数据会先暂存于内存中,而不立即写入硬盘。
no_root_squash:NFS服务器共享目录用户的属性,如果用户是 root,那么对于这个共享目录来说就具有 root 的权限
重启服务
sudo service nfs-kernel-server restart
mount测试
mount -o nolock 192.168.1.120:/home/flnet/kernel/tmp/tmp /mnt