10年 Java程序员,硬核人生!勇往直前,永不退缩!

欢迎围观我的git:https://github.com/R1310328554/spring_security_learn 寻找志同道合的有志于研究技术的朋友,关注本人微信公众号: 觉醒的码农,或Q群 165874185

  博客园  :: 首页  :: 新随笔  :: 联系 :: 订阅 订阅  :: 管理

exportfs -uv 不能卸载,

exportfs -au 才可以

================================================================================================================================================================================

参照 http://www.bkjia.com/Linux/766463.html 做, 结果出了很多问题, 看到 不同版本, 不能一个搞法。。

vi /etc/exports

/home/test 192.168.4.*(rw,sync,no_root_squash)
~

++++++

[root@lk1 ~]# service nfs restart
Shutting down NFS daemon: [ OK ]
Shutting down NFS mountd: [ OK ]
Shutting down NFS quotas: [ OK ]
Shutting down NFS services: [ OK ]
Shutting down RPC idmapd: [ OK ]
Starting NFS services: exportfs: No options for /home/test 192.168.4.(rw,sync,no_root_squash): suggest 192.168.4.(rw,sync,no_root_squash)(sync) to avoid warning
[ OK ]
Starting NFS quotas: [ OK ]
Starting NFS mountd: [ OK ]
Starting NFS daemon: [ OK ]
Starting RPC idmapd: [ OK ]

[root@lk1 ~]# exportfs -r
exportfs: No options for /home/test 192.168.4.(rw,sync,no_root_squash): suggest 192.168.4.(rw,sync,no_root_squash)(sync) to avoid warning

++++++++++++

但是
cat /var/log/messages | grep mount 没有看到任何错误。。

+++++++++++++++++++++++++++

[root@lk1 ~]# mount -t nfs 192.168.4.51:/home/test /mnt
mount.nfs: access denied by server while mounting 192.168.4.51:/home/test
[root@lk1 ~]#
[root@lk1 ~]# !ex
exportfs -r
exportfs: No options for /home/test 192.168.4.(rw,sync,no_root_squash): suggest 192.168.4.(rw,sync,no_root_squash)(sync) to avoid warning
[root@lk1 ~]#
[root@lk1 ~]# mount -t nfs 192.168.4.51:/home/test /mnt
mount.nfs: access denied by server while mounting 192.168.4.51:/home/test

++++++++++

showmount -e
Export list for lk1:
/home/test 192.168.4.*(rw,sync,no_root_squash)

++++++ showmount -d 没有结果
[root@lk1 ~]# showmount -d
Directories on lk1:

----------- 192.168.4.*(rw,sync,no_root_squash) <====== 原来是有 中文括号引起的!! 我擦 !!! 这些个我是从网页复制过来的, 没注意检查, 结果出了大问题啊!!!

++++++++++++++++++++++

=============================================================================================================================================

昨天配置NFS,中间没出现任何不正常的反映,但最后在客户端使用
mount -t nfs hdp1:/test /mnt
挂载NFS目录,显示

“mount.nfs:access denied by server while mounting hdp1:/test”

莫名其妙的被服务器拒绝,然后就一直搞不清有什么问题,提示是权限不够,所以就
chmod 777 /test
chmod 777 /mnt
并且用户都使用root
exports中的共享选项都是no_squash

但结果就是死活都是access denied。
没办法就上网搜索,有些说的tcp warpper限制,有的说是iptables限制,但都不适用于我这种情况。

最后不经意间看到有人说是exports的共享范围设置有问题,看了我的设置:
/test 192.168.2.*(rw,no_squash)

把192.168.2.换成192.168.2.3就可以了,但这样的话权限定义的就太细了,我要开放给2段,不能使用通配符,要使用192.168.2.0/24。
不知这到底是什么原因,个人猜测是不是NFS的代码上的验证方式。是否可以这么理解:在192.168.2.2上mount,NFS将配置hosts文件,使用127.0.0.1来与192.168.2.*进行验证,导致不能通过验证,所以结构就是access denied。

目前没有深究这个问题,可能是hosts文件有影响,等闲的时候再试试看。

posted on 2017-01-06 11:34  CanntBelieve  阅读(2816)  评论(0编辑  收藏  举报