第四次作业NFS服务器

架设一台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)

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值