首页
学习
活动
专区
圈层
工具
发布
首页
学习
活动
专区
圈层
工具
MCP广场
社区首页 >问答首页 >无法读取目录中的文件,即使ACL设置了

无法读取目录中的文件,即使ACL设置了
EN

Unix & Linux用户
提问于 2020-06-25 20:37:35
回答 1查看 822关注 0票数 0

我在列出目录/var/log/httpd的内容时遇到了问题,这个目录的用户拥有dba的第二个组成员,即使它有一个ACL。很久以前就起作用了。(我相信你以前也听说过。)

用户:oracle

组:

代码语言:javascript
运行
复制
[oracle] > groups
oinstall dba

当我试图列出目录/var/log/httpd或该目录中的一个文件的内容时,我会得到

代码语言:javascript
运行
复制
[oracle] > ls -o /var/log/httpd/access.log
ls: cannot access /var/log/httpd/access.log: Permission denied
[oracle] > ls -o /var/log/httpd/
ls: cannot open directory /var/log/httpd/: Permission denied

所以我在目录上做了一个getfacl,得到了以下内容:

代码语言:javascript
运行
复制
[oracle] > getfacl -p /var/log/httpd
# file: /var/log/httpd
# owner: root
# group: root
user::rwx
group::---
group:dba:r-x                   #effective:---
mask::---
other::---

当我对该目录中的文件执行getfacl时,我得到:

代码语言:javascript
运行
复制
[oracle] > getfacl -p /var/log/httpd/access.log
getfacl: /var/log/httpd/access.log: Permission denied

我看过的东西:

列出每个目录级别上的getfacl命令:

代码语言:javascript
运行
复制
[oracle] > ls -o /var/log/httpd/access.log
ls: cannot access /var/log/httpd/access.log: Permission denied
[oracle] > ls -o /var/log/httpd/
ls: cannot open directory /var/log/httpd/: Permission denied
[oracle] > ls  /var/log/httpd/
ls: cannot open directory /var/log/httpd/: Permission denied
[oracle] > ls  -d /var/log/httpd/
/var/log/httpd/
[oracle] > ls  -ld /var/log/httpd/
drwx------+ 2 root root 4096 Jun 21 03:19 /var/log/httpd/

选中每个父目录级别的ACL:

代码语言:javascript
运行
复制
[oracle] > getfacl -p /var/log
# file: /var/log
# owner: root
# group: root
user::rwx
group::r-x
other::r-x

[oracle] > getfacl -p /var
# file: /var
# owner: root
# group: root
user::rwx
group::r-x

Linux版本信息:

代码语言:javascript
运行
复制
[oracle] > uname -a
Linux plxxxx01 4.14.35-1902.7.3.el7uek.x86_64 #2 SMP Thu Oct 31 10:06:41 PDT 2019 x86_64 x86_64 x86_64 GNU/Linux

在阅读了man页面的getfacl之后,我看到了关于有效权限和掩码的信息,但是我仍然不知道为什么有效权限是dba组的#effective:---

EN

回答 1

Unix & Linux用户

回答已采纳

发布于 2020-06-25 20:56:13

mask::---是问题所在。此值限制命名用户和命名组的权限。换句话说:无论group:dba:的设置是什么,组都不会获得任何权限。

您可以使用setfacl -m m:rwx /var/log/httpd纠正这一问题。

票数 1
EN
页面原文内容由Unix & Linux提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://unix.stackexchange.com/questions/595104

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档