nfs mount:reason given by server: Permission denied +refused mount request XXX (/): not exported

执行下面的挂载命令

[htc@localhost ~]$ sudo mount -t nfs 192.168.64.128:/root/Desktop/NFS_Server /home/htc/Desktop/myTest
Password:
mount: 192.168.64.128:/root/Desktop/NFS_Server failed, reason given by server: Permission denied
[htc@localhost ~]$

怎么会Permission denied ? 没有权限....

接着:

[htc@localhost ~]$ su -
Password:
[root@localhost ~]# tail /var/log/messages

........


Mar 11 23:39:45 localhost mountd[6445]: refused mount request from 192.168.64.128 for /root/Desktop/NFS_Server (/): not exported

........

? 没有挂载? 明明是挂载了的啊? 

再看:

[root@localhost ~]# vi /etc/exports

/root/Desktop/NFS_Server  192.168.64.1(rw,sync)

这句话的意思是:将目录/root/Desktop/NFS_Server 用来共享再其他机器或系统访问, 在这里后面是192.168.64.1 表示只有这ip地址的机器才能访问这个NFS_Server 目录, rw表示对NFS_Server目录具有可读可写的权限 ,sync 表示异步写入

现在知道只有192.168.64.1这个ip地址的系统才具有访问权, 其它用户都没有访问权力咯


再查:


[htc@localhost ~]$ ifconfig
eth0      Link encap:Ethernet  HWaddr 00:0C:29:62:12:B4
          inet addr:192.168.64.128  Bcast:192.168.64.255  Mask:255.255.255.0
          inet6 addr: fe80::20c:29ff:fe62:12b4/64 Scope:Link
          UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1
          RX packets:9989 errors:0 dropped:0 overruns:0 frame:0
          TX packets:7946 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:1000
          RX bytes:888008 (867.1 KiB)  TX bytes:1281231 (1.2 MiB)
          Interrupt:67 Base address:0x2024

lo        Link encap:Local Loopback
          inet addr:127.0.0.1  Mask:255.0.0.0
          inet6 addr: ::1/128 Scope:Host
          UP LOOPBACK RUNNING  MTU:16436  Metric:1
          RX packets:1310 errors:0 dropped:0 overruns:0 frame:0
          TX packets:1310 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:0
          RX bytes:104100 (101.6 KiB)  TX bytes:104100 (101.6 KiB)


这里的ip是192.168.64.128 不是192.168.64.1 

再看:

login as: htc
htc@192.168.64.128's password:
Last login: Mon Mar 11 23:21:48 2013 from 192.168.64.1
[htc@localhost ~]$

看到上面的信息,我好像是在192.168.64.1登录的啊, 肿么ifconfig 显示的是上面的ip 192.168.64.128 ? 我就是被这个问题整了好久

其实问题是这样的:

我是用虚拟机登录了一台Linux系统, 但是我的这个系统除了有个root帐号外,我还设置了一个普通帐号 htc 

那我通过putty用htc帐号来登录这个linux系统 ,然后它就提示上面那个login from 192.168.64.1 这样的信息,我就误以为htc 登录是以192.168.64.1登录的, 所以我在root帐号下设置/etc/exports 的时候就写了对192.168.64.1可访问的权限, 但是因为我只打开了一个linux系统 那么无论我用putty 还是ssh 等登录工具 通过root帐号也好还是htc帐号也好 来登录这个linux系统时 其实这些通过这些登录工具登录进来的用户的ip地址一直是这个linux的ip地址, 也就是上面用ifconfig 查到的:192.168.64.128 , 所以上面exports中那个NFS_Server共享文件设置为192.168.64.1 其实没有这个ip 的系统登录的。 什么? 你还不相信? 好,那把这个NFS_Server后面的那个Ip给为192.168.64.128 或直接用* 代替,然后#/etc/init.d/nfs restart  然后再来sudo mount 试试, 这回就行了吧 



  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值