1.关闭防火墙
[root@server ~]# systemctl stop firewalld
[root@server ~]# setenforce 0
2.挂载并下载nfs
[root@server ~]# dnf install nfs-utils -y # 服务端及客户端都安装
3.在服务端写入配置
[root@server ~]# vim /etc/exports
[root@server ~]# cat /etc/exports
/nfs/shared *(ro)
/nfs/upload 192.168.92.0/24(rw,all_squash,anonuid=210,anongid=210)
/home/tom 192.168.92.131(rw)
4.创建文件,用户
[root@client ~]# mkdir -p /nfs/{shared,upload}
[root@client ~]# useradd -u 210 nfs-upload
useradd warning: nfs-upload's uid 210 outside of the UID_MIN 1000 and UID_MAX 60000 range.
[root@client ~]# useradd -u 1111 tom
[root@client ~]# id nfs-upload
uid=210(nfs-upload) gid=1001(nfs-upload) groups=1001(nfs-upload)
[root@client ~]# id tom
uid=1111(tom) gid=1111(tom) groups=1111(tom)
[root@client ~]#
5.修改文件权限
[root@client ~]# chmod o+w /nfs/upload
[root@client ~]# chmod 700 /home/tom
6.将客户端挂载到服务器
[root@client ~]# mount 192.168.92.130:/nfs/shared /server/shared
[root@client ~]# mount 192.168.92.130:/nfs/upload /server/shared
[root@client ~]# mount 192.168.92.130:/nfs/tom /server/shared