I have to understand how POSIX ACL mask is recalculated. I read the man pages (https://man7.org/linux/man-pages/man1/setfacl.1.html) and there is the following explanation:
The default behavior of setfacl is to recalculate the ACL mask entry, unless a mask entry was
explicitly given. The mask entry is set to the union of all permissions of the owning group, and
all named user and group entries.
Ok, it sounds clear, but in practice is not so easy as it seems. Let's suppose I have a group users and 2 users: student and jbond. The user student created a file test.txt with the following ACL list:
# file: test.txt
# owner: student
# group: users
user::rw-
user:jbond:rw- #effective:r--
group::r--
mask::r--
other::r--
For now student can read and write and jbond can only read. Then I changed group permissions with chmod:
chmod g-r test.txt
And now the ACL list is:
# file: test.txt
# owner: student
# group: users
user::rw-
user:jbond:rw- #effective:---
group::r-- #effective:---
mask::---
other::r--
And my question is how did it happen that the mask is ---
? How was performed the union operation that is described in man pages. Is it the same as logical OR? If it is how to calculate it step by step? I really need to understand it.
System info: Open SUSE
setfacl
while modern UNIX systems tend to implement everything insidechmod
.