1、启动服务(服务端)安全
systemctl enable rpcbind
systemctl start rpcbind
systemctl enable nfs-server
systemctl start nfs-server服务器
2、添加nfs配置:
在/etc/exports中追加
/data/audio/ 1.2.3.0/23(rw,sync,no_root_squash,no_subtree_check)async
有以下参数:ide
exports主要参数: rw:可读写权限 ro:只读权限 no_root_squash: 对于登录NFS主机的共享目录用户若是是root的话则对该目录具备root权限。 这样作极不安全,建议不用为好! root_squash: 对于登录NFS主机的共享目录用户使用者若是是root则它的权限将被压缩成匿名使用者, 同时它的UID和GID都会变成nobody那个系统帐号的身份。 all_squash: 无论登录NFS主机用户身份如何,它的身份都会被压缩成匿名使用者,一般就是nobody anonuid:anonuid=xxx, 制定NFS服务器/etc/passwd中匿名用户的UID anongid:anonuid=xxx, 制定NFS服务器/etc/passwd中匿名用户的GID sync: 数据在请求时写入共享 async: NFS在写入数据前可响应请求 secure: NFS经过1024如下的安全端口发送 insecure: NFS经过1024以上端口发送 hide: 不共享NFS目录的子目录 no_hide: 共享NFS目录的子目录
3、使配置生效
exportfs -rui
4、客户端挂载code
mount -t nfs 1.2.3.123:/data/audio/ /data/audio/server