架设一台NFS服务器,并按照以下要求配置
1、开放/nfs/shared目录,供所有用户查询资料
2、开放/nfs/upload目录,为192.168.100.0/24网段主机可以上传目录,
并将所有用户及所属的组映射为nfs-upload,其UID和GID均为210
3、将/home/tom目录仅共享给192.168.100.136这台主机,并只有用户tom可以完全访问该目录
server:
1、关闭防火墙
[root@localhost ~]# systemctl stop firewalld
[root@localhost ~]# setenforce 0
2、安装NFS
[root@localhost ~]# yum install -y nfs-utils
3、更改配置文件
[root@localhost ~]# vim /etc/exports
[root@localhost ~]# cat /etc/exports
/nfs/shared *(ro,sync)
4、重启NFS服务
[root@localhost ~]# systemctl restart nfs-server.service
5、创建挂载点目录
[root@localhost ~]# mkdir /nfs/shared -p
client:
1、关闭防火墙
[root@localhost ~]# systemctl stop firewalld
[root@localhost ~]# setenforce 0
2、查看共享目录
[root@localhost ~]# showmount -e 192.168.228.129
Export list for 192.168.228.129:
/nfs/shared *
3、创建目录并挂载
[root@localhost ~]# mkdir /test
[root@localhost ~]# mount 192.168.228.129:/nfs/shared /test
server:
1、创建共享目录
[root@localhost ~]# mkdir /nfs/upload
[root@localhost ~]# touch /nfs/upload/{1,2,3}
2、创建用户使UID和GID为210
[root@localhost ~]# useradd -r -u 210 nfs-upload
3、修改配置文件,并且重启服务
[root@localhost ~]# vim /etc/exports
[root@localhost ~]# cat /etc/exports
/nfs/upload 192.168.228.0/24 (rw,anonuid=210,anongid=210,sync)
[root@localhost ~]# systemctl restart nfs-server.service
client:
1、查看共享目录
[root@localhost ~]# showmount -e 192.168.228.129
Export list for 192.168.228.129:
/nfs/upload (everyone)
server:
1、创建挂载点目录进行挂载
[root@localhost ~]# mkdir /tests
[root@localhost ~]# mount 192.168.228.129:/nfs/upload /tests
2、设置所属组
[root@localhost ~]# chown nfs-upload.nfs-upload /nfs/upload
[root@localhost ~]# cd /nfs
[root@localhost nfs]# ll
total 0
drwxr-xr-x. 2 root root 6 Nov 13 22:01 shared
drwxr-xr-x. 2 nfs-upload nfs-upload 33 Nov 13 22:34 upload
3、修改配置文件
[root@localhost ~]# vim /etc/exports
/home/tom 192.168.228.129 (rw)
[root@localhost ~]# systemctl restart nfs-server.service .
[root@localhost ~]# useradd tom
[root@localhost ~]# ll -d /home/tom
drwx------. 3 tom tom 78 Nov 13 22:58 /home/tom
client:
测试[root@localhost ~]# su - tom
[tom@localhost ~]$ showmount -e 192.168.228.129
Export list for 192.168.228.129:
/nfs/shared *
/nfs/upload (everyone)
/home/tom (everyone)