架设一台NFS服务器,并按照以下要求配置
关闭防火墙
root@localhost \~\]# systemctl stop firewalld \[root@localhost \~\]# setenforce 0 配置文件设置: \[root@localhost \~\]# vim /etc/exports 1、开放/nfs/shared目录,供所有用户查询资料 共享文件目录 共享对象(权限) /nfs/shared \*(ro) 2、开放/nfs/upload目录,为192.168.xxx.0/24网段主机可以上传目录, /nfs/upload 192.168.115.0/24(rw,anonuid=210,anongid=210) 并将所有用户及所属的组映射为nfs-upload,其UID和GID均为210 创建用户nfs-upload \[root@localhost \~\]# useradd -u 210 nfs-upload \[root@localhost \~\]# groupmod -g 210 nfs-upload 或 \[root@localhost \~\]# useradd -r -u 210 nfs-upload 其UID和GID均为210 服务端开启对其他用户的写权限 \[root@localhost \~\]# chmod o+w /nfs/upload 3、将/home/tom目录仅共享给192.168.xxx.xxx这台主机,并只有用户tom对该目录有读写权限 /home/tom 192.168.115.133(rw) 创建tom用户 \[root@localhost \~\]# useradd tom 查看tom用户id \[root@localhost \~\]# id tom 重启nfs服务: \[root@localhost \~\]# systemctl restart nfs-server 加载新的配置内容信息 \[root@localhost \~\]# exportfs -ra 客户端: 查看可挂载文件 \[root@localhost \~\]# showmount -e 192.168.115.100 挂载/nfs/shared \[root@localhost t\]# mount 192.168.115.100:/nfs/shared /s 挂载/nfs/upload \[root@localhost t\]# mount 192.168.115.100:/nfs/upload /n挂载/home/tom \[root@localhost \~\]# mount 192.168.115.100:/home/tom /t 要发别创建挂载目录的目录 mkdir /t mkdir /s mkdir /n 自动挂载: \[root@localhost \~\]# vim /etc/fstab \[root@localhost \~\]# cat /etc/fstab 在配置文件最底下添加: