Linux – How ACL Calculates Effective Permissions on a File

aclfileslinuxpermissions

I ran the following command to give the wheel group rwx permissions on new files and subdirectories created:

[belmin@server1]$ ls -la
total 24
drwxr-sr-x+   2 guards guards  4096 Aug 27 15:30 .
drwxr-xr-x  104 root   root   12288 Aug 27 15:19 ..

[belmin@server1]$ sudo setfacl -m d:g:wheel:rwX .

[belmin@server1]$ getfacl .
# file: .
# owner: guards
# group: guards
# flags: -s-
user::rwx
group::r-x
group:wheel:rwx
other::r-x
default:user::rwx
default:group::r-x
default:group:wheel:rwx
default:mask::rwx
default:other::r-x

However, when I create a file as root, I am not completely clear how the effective permissions are calculated:

[belmin@server1]$ sudo touch foo

[belmin@server1]$ getfacl foo
# file: foo
# owner: root
# group: guards
user::rw-
group::r-x                      #effective:r--
group:wheel:rwx                 #effective:rw-
group:guards:rwx                #effective:rw-
mask::rw-
other::r--

Can someone elaborate on what this means?

Best Answer

effective permissions are formed by ANDing the actual (real?) permissions with the mask.  Since the mask of your file is rw-, all the effective permissions have the x bit turned off.

Related Question