加入收藏 | 设为首页 | 会员中心 | 我要投稿 李大同 (https://www.lidatong.com.cn/)- 科技、建站、经验、云计算、5G、大数据,站长网!
当前位置: 首页 > 综合聚焦 > 服务器 > Linux > 正文

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

发布时间:2020-12-13 18:35:23 所属栏目:Linux 来源:网络整理
导读:我正在尝试在两个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-utilsnfs-utils-1.3.0-0.el7.x86_64[root@ip-10-
我正在尝试在两个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来禁用它,因为它默认是打开的.

(编辑:李大同)

【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容!

    推荐文章
      热点阅读