There is a directory /test/test2/
. Its owner is root
and the group is test
and the permission is drwxr-xr-x
. I executed setfacl -m group:test:w ./
in that directory.
Now, as the user test
whose groups includes test
, if I run getfacl ./
in that directory, the output is,
# file: .
# owner: root
# group: test
user::rwx
group::r-x
group:test:-w-
mask::rwx
other::r-x
Now, if I execute touch test.txt
, I get touch: cannot touch 'test.txt': Permission denied
. Why is this so? Doesn't the setfacl -m
add the permission to the chmod
permission? I mean, I gave the test
group write permission with setfacl
, and since the group had r-x
in traditional permission (that can be changed with chmod
), doesn't this effectively give rwx
to the test
group?
I have tried namei -l /test/test2/
, and the output was
f: /test/test2/
drwxr-xr-x root root /
drwxr-xr-x root root test
drwxrwxr-x root test test2
yes
. When a file/dir hasACLs
this checks the permissions for the given user and if this one is not allowed for making reading,writing,executing then the action is rejected. Maybe you are confusing by what I answered to you some days ago in this answer: "However this behavior is correct because the Unix permissions and the owner drwxr-xr-x+ 2 guest guest allow to the guest user to cd and create files to /test/only_r" – Edgar Magallon Dec 07 '22 at 07:28only_r
was owed by the same user so it was able to change/modify/create files under that directory. In this case as you said thetest2
is owned by root as user, and test as group. But, I remember reading(but I did not find the thread) something aboutuser permissions
are primordial overgroup permissions
. – Edgar Magallon Dec 07 '22 at 07:34--x rwx --- test test
, as you can the test user hasx
permissions but its grouptest
hasrwx
permissions. Thus if you try to edit the file or reading it you will get aPermission Denied
even if you are in the same group. In your case it seems that thetest
group is ignored and the ACLs are applied. You can swap the owner of yourtest2
dir:sudo chown test:root
. And since the dir is now owned bytest
as a user theACLs
will be ignored (if you assign only write perms you will be able to read/write/change to the dir). – Edgar Magallon Dec 07 '22 at 07:44