• rhce 第十题 配置NFS服务


    配置NFS服务

    在system1配置NFS服务,要求如下:

    •  以只读的方式共享目录/public,同时只能被group8.example.com域中的系统访问
    •  以读写的方式共享目录/protected,同时只能被group8.example.com域中的系统访问
    •  访问/proteaced需要通过Kerberos安全加密,您可以使用下面URL提供的秘钥http://server.group8.example.com/pub/keytabs/system1.keytab
    •  目录/protected应该包含名为project拥有人为andres的子目录
    •  用户andres能以读写的方式访问/protected、project

    在system1上执行
    1、安装服务,并设定开启启动

    [root@system1 ~]# yum install nfs-utils -y (模拟考试实验环境不需要安装,安装就会升级到7.2)
    [root@system1 ~]# systemctl enable nfs-server nfs-secure-server
    ln -s '/usr/lib/systemd/system/nfs-server.service' '/etc/systemd/system/nfs.target.wants/nfs-server.service'
    ln -s '/usr/lib/systemd/system/nfs-secure-server.service' '/etc/systemd/system/nfs.target.wants/nfs-secure-server.service'

    2、设置防火墙规则

    [root@system1 ~]# firewall-cmd --permanent --add-service=nfs
    success
    [root@system1 ~]# firewall-cmd --permanent --add-service=rpc-bind
    success
    [root@system1 ~]# firewall-cmd --permanent --add-service=mountd
    success
    [root@system1 ~]# firewall-cmd --reload
    success

    3、设定目录及SElinux安全上下文

    [root@system1 ~]# mkdir -p /public
    [root@system1 ~]# mkdir -p /protected/project
    [root@system1 ~]# chown andres /protected/project/
    [root@system1 ~]# semanage fcontext -a -t 'public_content_t' '/project(/.*)?'
    [root@system1 ~]# semanage fcontext -a -t 'public_content_rw_t' '/project/project(/.*)?'
    [root@system1 ~]# restorecon -Rv /protected/
    [root@system1 ~]# restorecon -Rv /protected/project/

    4、下载kerberos证书

    [root@system1 ~]# wget -O /etc/krb5.keytab http://server.group8.example.com/pub/keytabs/system1.keytab

    5、编辑nfs资源导出配置文件

    [root@system1 ~]# vim /etc/exports
        /public *.group8.example.com(insecure,ro,sec=sys,sync)
        /protected      *.group8.example.com(insecure,rw,sec=krb5p,sync)

    6、修改nfs启动参数,并重启服务

    [root@system1 ~]# vim /etc/sysconfig/nfs 
    ...
    RPCNFSDARGS="-V 4.2"
    ...
    [root@system1 etc]# systemctl restart nfs-server nfs-secure-server

    7、刷新并导出资源

    [root@system1 etc]# exportfs -ra
    [root@system1 etc]# exportfs 
    /public           *.group8.example.com
    /protected        *.group8.example.com
  • 相关阅读:
    牛客算法周周练2
    牛客算法周周练2
    2020年7月7日Java学习日记
    2020年7月6日Java学习日记
    练习29--if语句
    练习28--布尔练习
    练习27--记忆逻辑
    第18~19讲课后作业
    第20讲:内嵌函数和闭包
    练习25--更多更多练习
  • 原文地址:https://www.cnblogs.com/despotic/p/10691980.html
Copyright © 2020-2023  润新知