无效的 ACL 配置

无效的 ACL 配置

我希望我的用户“tobias”和“www-data”都能够读取和写入特定目录。

为此,我将其所有权更改为 tobias:www-data,将 tobias 添加到 www-data 组,并将 setguid 添加到目录。文件和子目录正确创建,归 www-data 组所有。

据我所知,下一步是使用 ACL 为该特定目录设置特定的 umask。我希望它是 002,这样内容就被赋予了 rw-rw-r 权限。因此,我在 /etc/fstab 中的挂载中添加了“acl”,然后重新挂载了磁盘。到目前为止一切顺利。

以下是我的目录的 ACL 配置:

$ getfacl app/cache/
# file: app/cache/
# owner: tobias
# group: www-data
# flags: -s-
user::rwx
user:www-data:rwx
user:tobias:rwx
group::rwx
mask::rwx
other::r-x
default:user::rwx
default:user:www-data:rwx
default:user:tobias:rwx
default:group::rwx
default:mask::rwx
default:other::r-x

但即使我设置了 ACL,它仍然会创建具有 rw-r--r-- 权限的新文件和子目录。所以要么是我做错了什么,要么是我误解了这个概念。有人能帮我弄清楚我应该怎么做才能让它工作吗?

答案1

它似乎在这里起作用:

ubuntu-amd64% id | tr ',' '\n' | grep www-data
33(www-data)
ubuntu-amd64% mount | grep ' / '
/dev/sda1 on / type ext4 (rw,errors=remount-ro,acl)
ubuntu-amd64% sudo sh
ubuntu-amd64# cd /var/www
ubuntu-amd64# mkdir -p app/cache
ubuntu-amd64# chown fission:www-data app/cache
ubuntu-amd64# chmod 2775 app/cache
ubuntu-amd64# ls -ld app/cache
drwxrwsr-x 2 fission www-data 4096 2011-07-23 11:21 app/cache
ubuntu-amd64# setfacl -dm u::rwx,g::rwx,o::rx app/cache
ubuntu-amd64# getfacl app/cache
# file: app/cache
# owner: fission
# group: www-data
# flags: -s-
user::rwx
group::rwx
other::r-x
default:user::rwx
default:group::rwx
default:other::r-x

ubuntu-amd64# exit
ubuntu-amd64% umask
022
ubuntu-amd64% touch /var/www/app/cache/test
ubuntu-amd64% ls -l /var/www/app/cache/test
-rw-rw-r-- 1 fission www-data 0 2011-07-23 11:23 /var/www/app/cache/test

说实话,我不太了解 Linux ACL,但在我看来,该选项不是您所需要的 -按照上述设置选项mask就足够了。default:{user,group,other}

相关内容