yum install nfs* -y #安装nfs(须在客户机和服务器上均安装)
mkdir /srv/share #建立共享目录
chmod 777 /srv/share #赋予777权限
vim /etc/exports #编辑共享配置文件(默认空)
#添加
/srv/share 192.168.100.0/24(rw,sync)
#共享路径 允许访问网络(*表示所有) rw,sync为配置参数
systemctl restart nfs-server #重启nfs
firewall-cmd --zone=public --add-service=nfs -permanent #防火墙放行nfs服务
#配置参数:
rw 读写
ro 只读
hide 不共享子目录
sync 数据直接写入共享
insecure 使用1024以上端口
anonuid=xxx 指定映射用户UID
anongid=xxx 指定映射用户GID
all_squash 所有访问的用户均映射用户
root_squash root用户访问时映射用户
欢迎交流学习