分页: 1 / 1

ubuntu8.04在按下面配置NFS后挂载时出现mount.nfs: access denied

发表于 : 2009-02-13 22:13
Helen_xu
1.要安装NFS服务程序:
root@xuqinxiong-desktop:~# sudo apt-get install nfs-kernel-server

2.配置NFS

(1)配置portmap

方法2: $ sudo dpkg-reconfigure portmap , 对Should portmap be bound to the loopback address? 选N.

(2)配置/etc/hosts.deny

禁止任何host(主机)能和你的NFS服务器进行NFS连接,加入:

### NFS DAEMONS
portmap:ALL
lockd:ALL
mountd:ALL
rquotad:ALL
statd:ALL

(3)配 置/etc/hosts.allow

加入:
### NFS DAEMONS
portmap: 192.168.2.
lockd: 192.168.2.
rquotad: 192.168.2.
mountd: 192.168.2.
statd: 192.168.2.

root@xuqinxiong-desktop:~# sudo /etc/init.d/portmap restart
重启portmap daemon.

(4)配置/etc/exports
NFS挂载目录及权限由/etc/exports文件定义
加入: /zylinux/root 192.168.0.*(rw,sync,no_root_squash,no_subtree_check)

root@xuqinxiong-desktop:~#showmount -e
查看NFS server的export list.
终端显示为:Export list for xuqinxiong-desktop: /zylinux/root 192.168.2.*

若更改了/etc/exports, 运行 root@xuqinxiong-desktop:~# exportfs -r 更新

运行 root@xuqinxiong-desktop:~# sudo /etc/init.d/nfs-kernel-server restart 重启nfs服务

(5)测试NFS

我的主机IP地址设为是:192.168.0.130

我现在试把/zylinux/root 目录挂载到/mnt目录下
root@xuqinxiong-desktop:~# mount -t nfs 192.168.0.130:/zylinux/root /mnt

但是出现了以下错误:
mount.nfs: access denied by server while mounting 192.168.0.130:/zylinux/root /mnt

请问各位哥们是什么原因,是我的设置有遗漏或错误之处?

Re: ubuntu8.04在按下面配置NFS后挂载时出现mount.nfs: access denied

发表于 : 2009-02-27 20:23
eyeye
你的/etc/hosts.allow 和你的ip 192.168.0.130 在看看吧

Re: ubuntu8.04在按下面配置NFS后挂载时出现mount.nfs: access denied

发表于 : 2009-08-11 11:04
springydd
2 楼的回答不准确!
出现该问题,一般不太可能你把 /etc/hosts.allow 配错了!

一般主要是以下原因:
查看你的 /etc/hosts 文件,里面可能有如下内容:
192.168.0.130 xxx

nfs 在匹配 /etc/exports 的子网模式时,先进行了 hosts 解析,导致其使用机器名去判别,因此 access denied.

解决办法:
1. 在 /etc/exports 加入
/zylinux/root xxx(rw,sync,no_root_squash,no_subtree_check)
2. 或者 删除 /etc/hosts 文件中关于 192.168.0.130 的行

Re: ubuntu8.04在按下面配置NFS后挂载时出现mount.nfs: access denied

发表于 : 2009-12-11 14:23
ccs0223
回复 3 楼 springydd
在 /etc/hosts中药添加 192.168.2.53(host IP) localhost ,不能删除。