(新手上路,不足务喷!谢谢) 本文转自迅为讨论群: 挂载出现问题如下(192.168.40.6(localhost)为我ubuntu主机地址): 问题提示:mount.nfs: access denied by server while mounting localhost:/xxx/xxx/xxx(nfs共享目录,下面以/home/nfsrootfs举例) 由服务器同时安装本地主机访问被拒绝(google翻译) 可能的原因: ①原因一: 权限问题:可能是对/home/nfsrootfs的访问权限不够。 解决办法:chmod 777 /home/nfsrootf. ②原因二: 使用了非法端口:该问题描述可以进入vi /var/log/syslog文件查看,按下Shift+G可以跳到末页,便于查看。你会看到如下信息(以下不是我的出错日志,我的那个找不到了,不过问题是一样的) [root@lzgonline init.d]# vi /var/log/syslog 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 被拒绝的原因是因为使用了非法端口。 进一步说明://如果端口号大于1024,则需要将 insecure 选项加入到配置文件(/etc/exports)相关选项中mount客户端才能正常工作: 原因二解决办法: 修改配置文件/etc/exports,加入 insecure 选项 /home/nfsrootfs *(insecure,rw,async,no_root_squash) 保存退出 然后重启nfs服务:service nfs restart 我的是:#/etc/init.d/nfs-kernel-server restart (关于这一点你可以去/etc/init.d目录下看自己的可执行文件名是nfs还是nfs-kernel-server。 ③原因三: 没有配置hosts.deny和hosts.allow: 描述: 当你发现前俩个都没解决你的问题时,你就要考虑是不是原因三了,原因三系统日志描述或许如下: refused mount request from 192.168.40.6 for /home/taoshengyijiu/Desktop/NFS/system (/): no export entry exportfs –r会出现 exportfs: Failed to stat /home*(rw,sync,no_root_squash): No such file or director 或者挂载时出现超时。 打开这俩个配置文件添加如下代码: vi hosts.allow添加(192.168.40.)是你的主机IP,可以通过ifconfig查看 portmap:192.168.40. lockd:192.168.40. rquotad:192.168.40. mountd:192.168.40. statd:192.168.40. vi hosts.allow添加(192.168.40.)是你的主机IP,可以通过ifconfig查看 rtmap:ALL lockd:ALL mountd:ALL rquotad:ALL statd:ALL 保存退出,关于各个单词的专业详解,各位自己百度,不想琐碎地百度粘贴了。 $ sudo /etc/init.d/portmap restart 重启portmap daemon. 显示如下 Since the script you are attempting to invoke has been converted to an Upstart job, you may also use the restart(8) utility, e.g. restart portmap portmap start/running, process XXXX sudo exportfs -r 更新 $ sudo showmount 192.168.40.6 –e 显示 Export list for 192.168.40.6: /home/nfsrootfs * $ sudo /etc/init.d/nfs-kernel-server restart 重启nfs服务 显示如下 *Stopping NFS kernel daemon [OK] * Unexporting directories for NFS kernel daemon... [OK] * Exporting directories for NFS kernel daemon... exportfs: /etc/exports [1]: Neither 'subtree_check' or 'no_subtree_check' specified for export "*:/home/work". Assuming default behaviour ('no_subtree_check'). NOTE: this default has changed since nfs-utils version 1.0.x * Starting NFS kernel daemon [OK] 挂载 mount -t nfs 192.168.40.6:/home/nfsrootfs /mnt 其他情况请结合系统日志文件百度搜索,搜索过程因为是一个学习的过程。路漫漫其修远兮,吾将上下而求索
|