无法写入挂载点(nfs-server),获得“权限被拒绝”

前端之家收集整理的这篇文章主要介绍了无法写入挂载点(nfs-server),获得“权限被拒绝”前端之家小编觉得挺不错的,现在分享给大家,也给大家做个参考。
我正在尝试在两个RHEL7节点之间配置NFS:

第一个节点:

[root@ip-10-164-175-246 ~]# cat /etc/redhat-release 
Red Hat Enterprise Linux Server release 7.0 (Maipo)
[root@ip-10-164-175-246 ~]# rpm -q nfs-utils
nfs-utils-1.3.0-0.el7.x86_64
[root@ip-10-164-175-246 ~]# cat /etc/exports
/var/www/html/  ip-10-184-161-46.ec2.internal(rw)
[root@ip-10-164-175-246 ~]#

第二个节点:

[root@ip-10-184-161-46 ~]# mount ip-10-164-175-246.ec2.internal:/var/www/html/ /mnt/
[root@ip-10-184-161-46 ~]# touch /mnt/$$
touch: cannot touch ‘/mnt/3326’: Permission denied
[root@ip-10-184-161-46 ~]#

为什么我不能通过NFS向/ mnt /写入任何内容

解决方法

您的导出是否使用root_squash?从 CentOS docs

root_squash — Prevents root users connected remotely from having root
privileges and assigns them the user ID for the user nfsnobody. This
effectively “squashes” the power of the remote root user to the lowest
local user,preventing unauthorized alteration of files on the remote
server. Alternatively,the no_root_squash option turns off root
squashing. To squash every remote user,including root,use the
all_squash option. To specify the user and group IDs to use with
remote users from a particular host,use the anonuid and anongid
options,respectively. In this case,a special user account can be
created for remote NFS users to share and specify
(anonuid=,anongid=),where is the
user ID number and is the group ID number.

你需要添加标志no_root_squash来禁用它,因为它默认是打开的.

猜你在找的Linux相关文章