mount.nfs: access denied by server while mounting 192.168.3.12:/home/lzgonline/rootfshtml
百度、谷歌了好久,大部分都說是權限設置有問題,其實文件夾權限都設爲777了,權限上都沒問題,hosts.deny和hosts.allow都保留默認設置,防火牆也關了,該設置的都設置了,但仍是被拒絕,非常鬱悶,就在束手無策的時候,經過查看一些linux技術論壇後逐漸找到了問題所在。linux
首先使用命令查看出錯日誌文件網絡
[root@lzgonline init.d]# cat /var/log/messages | grep mountless
Jun 29 00:49:04 lzgonline mountd[1644]: refused mount request from 192.168.3.12 for /home/lzgonline/rootfs (/home/lzgonline/rootfs): illegal port 1689async
Jun 29 00:51:02 lzgonline mountd[1644]: refused mount request from 192.168.3.12 for /home/lzgonline/rootfs (/home/lzgonline/rootfs): illegal port 1710ide
Jun 29 01:02:17 lzgonline mountd[1644]: refused mount request from 192.168.3.12 for /home/lzgonline/rootfs (/home/lzgonline/rootfs): illegal port 1916ui
Jun 29 01:09:51 lzgonline mountd[1644]: refused mount request from 192.168.3.12 for /home/lzgonline/rootfs (/home/lzgonline/rootfs): illegal port 2157google
Jun 29 01:17:02 lzgonline mountd[1644]: refused mount request from 192.168.3.12 for /home/lzgonline/rootfs (/home/lzgonline/rootfs): illegal port 2318.net
從出錯日誌能夠看出,mount.nfs: access denied by server while mounting 192.168.3.12:/home/lzgonline/rootfs 被拒絕的緣由是由於使用了非法端口,功夫總沒白費,終於在一個linux技術論壇上找到了答案:unix
I googled and found that since the port is over 1024 I needed to add the "insecure" option to the relevant line in /etc/exports on the server. Once I did that (and ran exportfs -r), the mount -a on the client worked.
//若是端口號大於1024,則須要將 insecure 選項加入到配置文件(/etc/exports)相關選項中mount客戶端才能正常工做:
查看 exports 手冊中關於 secure 選項說明也發現確實如此
[root@lzgonline init.d]# man exports
secure,This option requires that requests originate on an Internet port less than IPPORT_RESERVED (1024). This option is on by default. To turn it off, specify insecure.
//secure 選項要求mount客戶端請求源端口小於1024(然而在使用 NAT 網絡地址轉換時端口通常老是大於1024的),默認狀況下是開啓這個選項的,若是要禁止這個選項,則使用 insecure 標識
修改配置文件/etc/exports,加入 insecure 選項
/home/lzgonline/rootfs *(insecure,rw,async,no_root_squash)
保存退出
而後重啓nfs服務:service nfs restart
而後問題就解決了
轉自http://blog.chinaunix.net/uid-20554957-id-3444786.html