远程挂载NFS时mount.nfs: access denied by server while mounting 一个解决办法

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

相关文章
相关标签/搜索