exportfs -uv 不能卸載,
exportfs -au 才可以
================================================================================================================================================================================
參照 http://www.bkjia.com/Linux/766463.html 做, 結果出了很多問題, 看到 不同版本, 不能一個搞法。。
vi /etc/exports
/home/test 192.168.4.*(rw,sync,no_root_squash)
~
++++++
[root@lk1 ~]# service nfs restart
Shutting down NFS daemon: [ OK ]
Shutting down NFS mountd: [ OK ]
Shutting down NFS quotas: [ OK ]
Shutting down NFS services: [ OK ]
Shutting down RPC idmapd: [ OK ]
Starting NFS services: exportfs: No options for /home/test 192.168.4.(rw,sync,no_root_squash): suggest 192.168.4.(rw,sync,no_root_squash)(sync) to avoid warning
[ OK ]
Starting NFS quotas: [ OK ]
Starting NFS mountd: [ OK ]
Starting NFS daemon: [ OK ]
Starting RPC idmapd: [ OK ]
[root@lk1 ~]# exportfs -r
exportfs: No options for /home/test 192.168.4.(rw,sync,no_root_squash): suggest 192.168.4.(rw,sync,no_root_squash)(sync) to avoid warning
++++++++++++
但是
cat /var/log/messages | grep mount 沒有看到任何錯誤。。
+++++++++++++++++++++++++++
[root@lk1 ~]# mount -t nfs 192.168.4.51:/home/test /mnt
mount.nfs: access denied by server while mounting 192.168.4.51:/home/test
[root@lk1 ~]#
[root@lk1 ~]# !ex
exportfs -r
exportfs: No options for /home/test 192.168.4.(rw,sync,no_root_squash): suggest 192.168.4.(rw,sync,no_root_squash)(sync) to avoid warning
[root@lk1 ~]#
[root@lk1 ~]# mount -t nfs 192.168.4.51:/home/test /mnt
mount.nfs: access denied by server while mounting 192.168.4.51:/home/test
++++++++++
showmount -e
Export list for lk1:
/home/test 192.168.4.*(rw,sync,no_root_squash)
++++++ showmount -d 沒有結果
[root@lk1 ~]# showmount -d
Directories on lk1:
----------- 192.168.4.*(rw,sync,no_root_squash) <====== 原來是有 中文括號引起的!! 我擦 !!! 這些個我是從網頁復制過來的, 沒注意檢查, 結果出了大問題啊!!!
++++++++++++++++++++++
=============================================================================================================================================
昨天配置NFS,中間沒出現任何不正常的反映,但最后在客戶端使用
mount -t nfs hdp1:/test /mnt
掛載NFS目錄,顯示
“mount.nfs:access denied by server while mounting hdp1:/test”
莫名其妙的被服務器拒絕,然后就一直搞不清有什么問題,提示是權限不夠,所以就
chmod 777 /test
chmod 777 /mnt
並且用戶都使用root
exports中的共享選項都是no_squash
但結果就是死活都是access denied。
沒辦法就上網搜索,有些說的tcp warpper限制,有的說是iptables限制,但都不適用於我這種情況。
最后不經意間看到有人說是exports的共享范圍設置有問題,看了我的設置:
/test 192.168.2.*(rw,no_squash)
把192.168.2.換成192.168.2.3就可以了,但這樣的話權限定義的就太細了,我要開放給2段,不能使用通配符,要使用192.168.2.0/24。
不知這到底是什么原因,個人猜測是不是NFS的代碼上的驗證方式。是否可以這么理解:在192.168.2.2上mount,NFS將配置hosts文件,使用127.0.0.1來與192.168.2.*進行驗證,導致不能通過驗證,所以結構就是access denied。
目前沒有深究這個問題,可能是hosts文件有影響,等閑的時候再試試看。