nfs
来源:互联网 发布:地球生态数据 编辑:程序博客网 时间:2024/06/11 12:40
syns 数据实时同步
kerberos
0.准备工作
配置yum源(有server和desktop的钥匙)
打开防火墙并进行配置(也可直接关闭防火墙,但是这样不安全)
打开nfs
在desktop端测试显示如下为成功
建立共享目录
vim /etc/exports
/public *(sync)
exportfs -rv
显示exporting *:/public
只有此ip能访问
非此ip
此ip
建立文件属于root用户
也可用id的方式设定
1.
yum install nfs-utils
systemctl enbale nfs-server
systemctl start nfs-server
firewall-cmd –permanent –add-service=nfs
firewall-cmd –permanent –add-service=rpc-bind
firewall-cmd –permanent –add-service=mountd
2.共享目录
systemctl start nfs-server
mkdir /public
chmod 777 /public
vim /etc/esports ##man 5 exports
要共享的系统目录 共享方式
/public *(sync) ##public共享给所有人并且数据同步
/public 172.25.0.0/24(sync) ##public共享给172.25.0.0/24网段
/public *.example.com(sync) ##public共享给example.com域的所有主机
/public 172.25.0.11(ro,sync) 172.25.0.250(rw,sync) ##public共享给11是只读,250是读写
/public *(sync,no_root_squash) ##public共享给所有人,当客户端使用root挂载不转换用户身份
/public *(sync,anonuid=1001,anongid=1000) ##public共享给所有人以1001为uid,1000为gid
exportfs -rv
3.利用kerberos保护nfs输出
在desktop和server端同样进行以下操作
yum install sssd krb5-workstation authconfig-gtk -y
首先开启kerberos认证,得到ldap用户
authconfig-gtk
测试:
systemctl start nfs-secure
systemctl enable nfs-secure
下载钥匙(sever下载server对应的,desktop下载desktop对应的):
查看钥匙:
再测试
mount 172.25.0.11:/public /mnt -o sec=krb5p
su - student
cd /mnt
su - ldapuser1
klist
ls /mnt
注意:地址解析要对(vim /etc/hosts),可以dig出来severX.example.com和desktopX.example.com