您的位置:首页 > 产品设计 > UI/UE

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

2013-03-11 23:37 411 查看
执行下面的挂载命令

[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 试试, 这回就行了吧 
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
相关文章推荐