如何从目录中删除 ACL 并恢复到通常的访问控制?

Tai*_*sho 35 acl permissions

我们使用 FreeBSD 10.3 的托管服务器,我们没有超级用户的权限。我们使用服务器运行我们公司网页的apache2。我们网页的前任管理员似乎为目录设置了 ACL 权限,但我们想删除它。假设该目录名为foobar.

现在的结果ls -al foobar如下:

drwxrwxr-x+   2 myuser  another_user   512 Nov 20  2013 foobar
Run Code Online (Sandbox Code Playgroud)

权限如下:

[myuser@hosting_server]$ getfacl foobar
# file: foobar/
# owner: myuser
# group: another_user
user::rwx
group::rwx
mask::rwx
other::r-x
Run Code Online (Sandbox Code Playgroud)

这里我们要删除ACL权限和权限列表最后的加号。因此,我们做了

setfacl -b foobar
Run Code Online (Sandbox Code Playgroud)

它取消了 ACL 管理的特殊权限,但没有删除加号+

我们的问题是我们如何删除+“ls -al foobar”显示的权限列表中的加号?

Tai*_*sho 39

我们的问题是通过使用解决的:

setfacl -bn foobar
Run Code Online (Sandbox Code Playgroud)

关键是我们还必须使用选项 -n 从目录中删除 aclMask... 的手册页setfacl如下所示:

 -n      Do not recalculate the permissions associated with the ACL mask
         entry.  This option is not applicable to NFSv4 ACLs.
Run Code Online (Sandbox Code Playgroud)

我们不确定为什么这个选项有效,但它确实......


如果您d?????????在上述解决方案后获得许可,请尝试chmod -R a+rX按照下面的两个评论。


小智 16

您应该尝试使用递归选项。

setfacl -R -b foobar
Run Code Online (Sandbox Code Playgroud)

不需要-n选项


mau*_*wns 5

奇怪...无法重现:

ls -l | grep foobar
drwxr-xr-x+ 2 maulinglawns maulinglawns 4096 jan 24 14:25 foobar

setfacl -b foobar/
ls -l | grep foobar
drwxr-xr-x 2 maulinglawns maulinglawns 4096 jan 24 14:25 foobar
Run Code Online (Sandbox Code Playgroud)

不幸的是,我现在无法访问 BSD 进行测试。


系统信息:

Distributor ID: Debian
Description:    Debian GNU/Linux 8.7 (jessie)
Release:    8.7
Codename:   jessie
Run Code Online (Sandbox Code Playgroud)