################nfs################vim
##################################ide
1.nfs準備測試
systemctl start nfs-serverui
systemctl enable nfs-serverspa
systemctl stop firewalldorm
firewalld-cmd --permanent --add-service=nfsserver
firewalld-cmd --permanent --add-service=rpc-bindblog
firewalld-cmd --permanent --add-service=mountdci
2.共享目錄rpc
systemctl start nfs-server
mkdir /public
chmod 777 /publc
vim /etc/exportfs
/public *(sync) ###public共享給全部人並數據同步
/public 172.25.254.1(sync) ###public只共享給172.25/254.1 主機
/public *.example.com(sync) ###public之共享給example.com這個域
測試時先在102主機作解析
/public 172.25.254.101(ro,sync) 172.25.254.1(rw,sync)###public共享給101只能夠讀,共享給1主機能夠讀寫
/public *(sync,no_root_squash) ###public共享給全部人,當客戶端使用root掛載時不轉換用戶身份
/public *(sync,anonuid=1001,anongid=1000) ###public共享給全部人以1001爲uid,1000爲gid
3.利用kerberos保護nfs輸出
在server上
開啓kerberos認證,獲得ldap用戶
wget ://172.25.254.254/pub/keytabs/server1.kettab -O /etc/krb5.keytab
ktutil
ktutil: rkt /etc/krb5.keytab
ktutil: list
systemctl start nfs-secure-srever
systemctl enable nfs-secure-server
vim /etc/exports
/public *(rw,sec=krb5p)
exports -rv
在desktop上
開啓kerberos認證,獲得ldap用戶
wget httpd://172.25.254.254/pub/keytabs/desktop1.kettab -O /etc/krb5.keytab
ktutil
ktutil: rkt /etc/krb5.keytab
ktutil: list
systemctl start nfs-secure
systemctl enable nfs-secure
mount 172.25.254.102:/public /mnt -o sec=krb5p
su-student
cd /mnt ### 沒有進行kerberos認證,權力受限
su-ldapuser1
klist
ls /mnt ###進行了kerberos認證,能夠查看