加入收藏 | 设为首页 | 会员中心 | 我要投稿 李大同 (https://www.lidatong.com.cn/)- 科技、建站、经验、云计算、5G、大数据,站长网!
当前位置: 首页 > 综合聚焦 > 服务器 > Linux > 正文

配置NFS服务

发布时间:2020-12-14 01:09:08 所属栏目:Linux 来源:网络整理
导读:在 system1 配置NFS服务,要求如下: 1、以只读的方式共享目录 /public ,同时只能被 group8.example.com 域中的系统访问 2、以读写的方式共享目录 /protected ,同时只能被 group8.example.com 域中的系统访问 3、访问 /protected 需要通过Kerberos安全加密

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

1、以只读的方式共享目录 /public ,同时只能被 group8.example.com 域中的系统访问

2、以读写的方式共享目录 /protected ,同时只能被 group8.example.com 域中的系统访问

3、访问 /protected 需要通过Kerberos安全加密,您可以使用URL提供的密钥 http://server.group8.example.com/pub/keytabs/system1.keytab

4、目录 /protected 应该包含名为 project 拥有人为 andres 的子目录

5、用户 andres 能以读写方式访问 /protected/project

答:

1、安装nfs服务端工具包

yum install nfs-utils -y

2、设置开机自启动

systemctl enable nfs-server nfs-secure-server

3、设置防火墙

firewall-cmd --permanent --add-server=nfs
firewall-cmd --permanent --add-server=rpc-bind
firewall-cmd --permanent --add-server=mountd
firewall-cmd --reload

4、设定目录及SELinux 安全上下文

# 创建共享目录
mkdir -p /public /protected/project

# 添加权限
chown andres /protected/project

# 添加SELinux
semanage fcontext -a -t public_content_t /protected(/.*)?
semanage fcontext -a -t public_content_rw_t /protected/project(/.*)?
restorecon -Rv /protected/

5、下载 kerberos 证书

wget -O /etc/krb5.keytab http://server.group8.example.com/pub/keytabs/system1.keytab

6、编辑 nsf 资源导出配置文件

vim /etc/exports

/public *.group8.example.com(ro,sec=sys,sync)
/protected *.group8.example.com(rw,sec=krb5p,sync)

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

vim /etc/sysconfig/nfs

...
RPCNFSDARGS="-V 4.2"
systemctl restart nfs-server.service nfs-secure-server.service

8、刷新并验证导出资源

exportfs -ra
exportfs

...
...

更多详情:https://www.cnblogs.com/xiangsikai/p/8398433.html

(编辑:李大同)

【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容!

    推荐文章
      热点阅读