#NFS#


1.服务安装及启用

[[email protected] ~]# yum install nfs-utils -y

[[email protected] ~]# systemctl start nfs-server

[[email protected] ~]# systemctl enable nfs-server

 


2.火墙配置

[[email protected] ~]# firewall-cmd --permanent --add-service=nfs##允许nfs服务

[[email protected] ~]# firewall-cmd --permanent --add-service=rpc-bind##支持端口分配

[[email protected] ~]# firewall-cmd --permanent --add-service=mountd##允许挂载服务

[[email protected] ~]# firewall-cmd --reload

LInux学习笔记 --NFS 

 


3.共享目录

[[email protected] ~]# mkdir /public

[[email protected] ~]# chmod 777 /public

[[email protected] ~]# touch /public/hahaha{1..6}

 

[[email protected] ~]# vim /etc/exports ##man 5 exports

要共享的目录 共享方式


/public *(sync)##public共享给所有人并且数据同步 sync-数据实时同步

LInux学习笔记 --NFS


/public 172.25.29.0/24(sync)##public共享给172.25.29.0/24网段且数据同步

LInux学习笔记 --NFS


/public          *.example.com(sync) ##public共享给example.com域的所有主机

LInux学习笔记 --NFS


/public          172.25.29.10(ro,sync) ##public共享给172.25.29.10是只读

LInux学习笔记 --NFS


/public          172.25.29.10(rw,sync)    ##public共享给172.25.29.10是读写

LInux学习笔记 --NFS


/public          *(rw,sync,no_root_squash) ##public共享给所有人,当客户端用超级用户挂载时不转换用户身份

LInux学习笔记 --NFS


/public         *(rw,sync,anonuid=1001,anongid=1000) ##public共享给所有人以1001为uid,1000为gid

LInux学习笔记 --NFS


[[email protected] ~]# exportfs -rv ##刷新

 

[[email protected] ~]# mount 172.25.29.11:/public /mnt/##挂载

LInux学习笔记 --NFS


 

4.利用kerberos保护nfs输出

 

[[email protected] ~]# yum install sssd krb5-workstation authconfig-gtk -y

 

[在server上]

 

#开启kerberos认证,得到ldap用户

[[email protected] ~]# authconfig-gtk

LInux学习笔记 --NFS


[[email protected] ~]# wget http://172.25.254.254/pub/keytabs/server29.keytab -O /etc/krb5.keytab ##下载server29.keytab

[[email protected] ~]# ktutil ##查看server29.keytab

ktutil:  rkt /etc/krb5.keytab

ktutil:  list

LInux学习笔记 --NFS


[[email protected] ~]# systemctl start nfs-secure-server

[[email protected] ~]# systemctl enable nfs-secure-server


[[email protected] ~]# vim /etc/exports

/public         *(rw,sec=krb5p)

LInux学习笔记 --NFS


[[email protected] ~]# exportfs -rv

LInux学习笔记 --NFS


[在desktop上]

 

#开启kerberos认证,得到ldap用户

[[email protected] ~]# authconfig-gtk

LInux学习笔记 --NFS

LInux学习笔记 --NFS


[[email protected] ~]# wget http://172.25.254.254/pub/keytabs/desktop29.keytab -O /etc/krb5.keytab ##下载desktop29.keytab

[[email protected] ~]# ktutil ##查看desktop29.keytab

ktutil:  rkt /etc/krb5.keytab

ktutil:  list

LInux学习笔记 --NFS


[[email protected] ~]# systemctl start nfs-secure

[[email protected] ~]# systemctl enable nfs-secure

LInux学习笔记 --NFS

[[email protected] ~]# vim /etc/hosts

172.25.29.11 server29.example.com ##解析


[[email protected] ~]# mount 172.25.29.11:/public /mnt/ -o sec=krb5p##用krb5p方式挂载

[[email protected] ~]# su - student

[[email protected] ~]$ ls /mnt/

[[email protected] ~]$ su - ldapuser1 ##若从超级用户切入ldap用户不需输入密码,则缺少票据

Password: ##密码为kerberos

-bash-4.2$ ls /mnt/

LInux学习笔记 --NFS

相关文章:

  • 2021-09-30
  • 2021-08-02
  • 2021-08-07
  • 2021-08-08
  • 2021-05-11
  • 2021-08-13
  • 2021-05-21
猜你喜欢
  • 2021-11-07
  • 2021-11-29
  • 2021-08-12
  • 2021-07-16
  • 2021-09-27
  • 2021-06-11
相关资源
相似解决方案