ubuntu11.04配置nfs--解决mount.nfs: access denied问题

总算通过了nfs的localhost测试。

 

配置很简单,下面摘自网络,并且整理下:

 

1 安装nfs

#apt-get install nfs-kernel-server

#apt-get install nfs-common

 

2 配置/etc/exports

在文本末添加

#/root/nfs_root *(rw,sync,no_root_squash)

#chmod 777 -R /root/nfs_root

 

可以使用showmount -e来查看当前的配置是否已经生效

#showmount -e                     

Export list for medea-MS-7680:

 

说明还没有生效。

 

使用exportfs -r 更新配置

#exportfs -r

#showmount -e

Export list for medea-MS-7680:

/root/nfs_root *

 

3 启动

#/etc/init.d/nfs-kernel-server restart    重新nfs服务

 

 

简单吧,通过3步骤一般就可以使用nfs了。就可以使用localhost进行本地mount测试了。

网络一般还会配置/etc/hosts.deny与/etc/hosts.allow。主要是配置ip访问的权限控制。但是我不想配置,感觉个人电脑上没有什么重要的东西。就忽略了。

 

 

好了,我的噩梦开始了。

#mount -t nfs localhost:/root/nfs_root /root/book


出现了如下的提示:mount.nfs: access denied by server while mounting localhost:/root/nfs_root



花了我3天的时间,检测。 发现在公司的电脑配置没有问题。就家里的台式机会出问题。

网上search找不到任何原因。 郁闷了。


后来,我尝试了重新配置/home/medea作为挂载点,发现居然通过了。


我就到根目录下,   ls -al。总算发现问题了。原来我的/root的权限是     drwx------  43 root root  4096 2011-09-18 07:43 root


我就想到了, 本地mount上后,会是另一种用户登录。   原来是root访问权限出问题了。


于是:

#chmod 755 /root 


在尝试

#mount -t nfs localhost:/root/nfs_root /root/book

 

OK!    成功。 ^_^

 

 

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值