mount.nfs: access denied by server while mounting 一個解決辦法

來源:互聯網
上載者:User

http://blog.chinaunix.net/uid-20554957-id-3444786.html

mount.nfs: access denied by server while mounting 一個解決辦法  
2011-06-30 17:22:06|  分類: 技術探討 |  標籤:linux  常見問題  伺服器   |字型大小 訂閱 這兩天在搭建嵌入式開發環境,配置好NFS伺服器後,遇到了一個很糾結的錯誤 使用 mount -t nfs 127.0.0.1:/home/lzgonline/rootfs /mnt 和 mount -t nfs 192.168.1.9:/home/lzgonline/rootfs /mnt 本機掛載nfs則沒有問題,然而使用 mount -t nfs 192.168.3.12:/home/lzgonline/rootfs /mnt 時卻出現了問題,導致開發板無法通過nfs掛載啟動,其中192.128.3.12 和 192.128.1.9(即nfs伺服器)之間建立了映射(DMZ)關係。 mount.nfs: access denied by server while mounting 192.168.3.12:/home/lzgonline/rootfs 百度、Google了很久,大部分都說是使用權限設定有問題,其實檔案夾許可權都設為777了,許可權上都沒問題,hosts.deny和hosts.allow都保留預設設定,防火牆也關了,該設定的都設定了,但還是被拒絕,很是鬱悶,就在一籌莫展的時候,通過查看一些linux技術論壇後逐漸找到了問題所在。 首先使用命令查看出錯記錄檔 [root@lzgonline init.d]# cat /var/log/messages | grep mount 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 1689 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 1710 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 1916 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 2157 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   從出錯日誌可以看出,mount.nfs: access denied by server while mounting 192.168.3.12:/home/lzgonline/rootfs 被拒絕的原因是因為使用了非法連接埠,功夫總沒白費,終於在一個linux技術論壇上找到了答案: 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
然後問題就解決了

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.