在 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

...
...

在 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

...
...