zoukankan      html  css  js  c++  java
  • 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
  • 相关阅读:
    [BZOJ2049] [SDOI2008] 洞穴勘测
    BZOJ2594: [Wc2006]水管局长数据加强版
    P4211[BZOJ 3626] [LNOI2014]LCA
    FindLetter 类——查找文件中特定的字符,每一行开头为某一个字符,则跳过
    SolrJ 的运用
    Golang
    注册免费试用12个月的亚马逊AWS云计算服务
    TensorFlow学习笔记(一)
    Hexo之旅(四):文章编写技巧
    高阶函数
  • 原文地址:https://www.cnblogs.com/despotic/p/10691980.html
Copyright © 2011-2022 走看看