-rw-r-----+ 1 kevin admin 0 Feb 16 09:58 someFile
-rw-r-----+ 1 kevin admin 0 Feb 16 09:58 someFile
WITHOUT ACL -rw------- 1 kevin admin 0 Feb 16 12:02 tmpFile.SRnstAdC # file: tmpFile.SRnstAdC # owner: kevin # group: admin user::rw- group::--- other::--- WITH ACL -rw-r-----+ 1 kevin admin 0 Feb 16 12:02 tmpFile.SRnstAdC # file: tmpFile.SRnstAdC # owner: kevin # group: admin user::rw- user:nobody:r-- group::--- actual group permissions mask::r-- other::---
WITHOUT ACL drwx------ 2 kevin admin 4096 Feb 16 12:07 tmpThing.7mJSe9Pi # file: tmpThing.7mJSe9Pi # owner: kevin # group: admin user::rwx group::--- other::--- WITH ACL drwxr-----+ 2 kevin admin 4096 Feb 16 12:07 tmpThing.7mJSe9Pi # file: tmpThing.7mJSe9Pi # owner: kevin # group: admin user::rwx user:nobody:r-- group::--- actual group permissions mask::r-- other::---
WITHOUT ACL drwx------ 2 kevin admin 4096 Feb 16 12:10 tmpThing.RmfK2aru # file: tmpThing.RmfK2aru # owner: kevin # group: admin user::rwx group::--- other::--- -rw------- 1 kevin admin 0 Feb 16 12:10 tmpThing.RmfK2aru/tmpThing.zQMz5UHf # file: tmpThing.RmfK2aru/tmpThing.zQMz5UHf # owner: kevin # group: admin user::rw- group::--- other::--- WITH ACL drwxr-x---+ 2 kevin admin 4096 Feb 16 12:10 tmpThing.RmfK2aru # file: tmpThing.RmfK2aru # owner: kevin # group: admin user::rwx user:nobody:r-x due to therX
in setfacl group::--- mask::r-x other::--- -rw-r-----+ 1 kevin admin 0 Feb 16 12:10 tmpThing.RmfK2aru/tmpThing.zQMz5UHf # file: tmpThing.RmfK2aru/tmpThing.zQMz5UHf # owner: kevin # group: admin user::rw- user:nobody:r-- not a directory, not executable, so only gains ar
group::--- mask::r-- other::---
I've also seen situations where files get an extra "x" in their "group permissions". Looks related to : - permissions on parent directory - permissions inherited by default ACL - "create dir THEN set ACL (with -R, with default ACL) THEN create subfile" vs "create dir+file THEN set ACL (with -R, with default ACL)" - ... ==> not clear yet, to be investigated when playing/replaying commands and comparing "ls" before/after output, mind the extra characters : -rw-r--r--+ 1 kevin admin 0 Feb 15 16:20 myFile BEFORE setfacl ... -rw-r-xr--+ 1 kevin admin 0 Feb 15 16:20 myFile AFTER setfacl ... - the AFTER line has a "+", which is no surprise since we just added an ACL with setfacl - the BEFORE line also has a "+", meaning other ACL existed prior to this experiment, which _could_ explain the extra x
CONFIG_EXT2_FS_POSIX_ACL=y CONFIG_EXT3_FS_POSIX_ACL=y CONFIG_EXT4_FS_POSIX_ACL=y CONFIG_REISERFS_FS_POSIX_ACL=y CONFIG_JFS_POSIX_ACL=y CONFIG_XFS_POSIX_ACL=y CONFIG_BTRFS_FS_POSIX_ACL=y CONFIG_FS_POSIX_ACL=y CONFIG_TMPFS_POSIX_ACL=y CONFIG_JFFS2_FS_POSIX_ACL=y CONFIG_9P_FS_POSIX_ACL=y
/dev/mapper/vg-home /home ext4 defaults,noatime 0 2
use the default mount options as specified by the filesystem itself. So let's view these default mount options (source), as root :
Default mount options
'Default mount options: user_xattr acl
-rw-r--r--+ 1 kevin users 343 2005-02-07 16:53 someFile
the file foo.txt has an ACLis
the file foo.txt has an extended ACL.
Entry type | Text form |
---|---|
owner | user::rwx |
named user | user:stuart:rwx |
owning group | group::rwx |
named group | group:admins:rwx |
mask | mask::rwx |
others | other::rwx |
workswith the named user + named group attributes
maskedand thus do not take effect
for a named user | for a named group | |
---|---|---|
group class permissions | user:bob:r-x | group:developers:r-- |
mask | mask::rw- | |
Effective permissions | r-- | r-- |
# file: someFile # owner: kevin # group: users user::rw- group::r-- mask::rwx other::r--
tmpDir=$(mktemp -d playingWithAcl.XXXX); otherUser='www-data'; mkdir -p "$tmpDir" echo 'created BEFORE applying default ACL' > "$tmpDir/before" setfacl -m u:$otherUser:rwx "$tmpDir" setfacl -d -m u:$otherUser:rwx "$tmpDir" echo 'created AFTER applying default ACL' > "$tmpDir/after" getfacl "$tmpDir/"{before,,after} rm "$tmpDir/"{before,after}; rmdir "$tmpDir"
# file: playingWithAcl.zFLo/before # owner: bob # group: developers user::rw- group::--- other::--- # file: playingWithAcl.zFLo/ # owner: bob # group: developers user::rwx user:www-data:rwx effect of setfacl -m u: group::--- mask::rwx other::--- default:user::rwx default:user:www-data:rwx effect of setfacl -d -m u: default:group::--- the other default: entries have been copied from the access ACL default:mask::rwx default:other::--- # file: playingWithAcl.zFLo/after # owner: bob # group: developers user::rw- user:www-data:rwx #effective:rw- effect of the default ACL. This also displays the effective permissions. group::--- mask::rw- other::---
tmpDir=$(mktemp -d baseDirectory.XXXX); otherUser='www-data'; mkdir -p "$tmpDir" setfacl -m u:$otherUser:rwx "$tmpDir" setfacl -d -m u:$otherUser:rwx "$tmpDir" mkdir -p "$tmpDir/child_dir/grandchild_dir" touch "$tmpDir/child_file" touch "$tmpDir/child_dir/grandchild_file" touch "$tmpDir/child_dir/grandchild_dir/grandgrandchild_file" getfacl "$tmpDir/"{,child_file,child_dir,child_dir/grandchild_file,child_dir/grandchild_dir,child_dir/grandchild_dir/grandgrandchild_file} [ -d "$tmpDir" ] && rm -r "$tmpDir"
# file: baseDirectory.uA7J/ # owner: matth # group: matth user::rwx user:www-data:rwx effect of setfacl -m u: group::--- mask::rwx other::--- default:user::rwx default:user:www-data:rwx effect of setfacl -d -m u: default:group::--- default:mask::rwx default:other::--- # file: baseDirectory.uA7J/child_file # owner: matth # group: matth user::rw- user:www-data:rwx #effective:rw- access ACL inherited from baseDirectory. group::--- mask::rw- other::--- # file: baseDirectory.uA7J/child_dir # owner: matth # group: matth user::rwx user:www-data:rwx access ACL inherited from baseDirectory. group::--- mask::rwx other::--- default:user::rwx default:user:www-data:rwx default ACL inherited from baseDirectory. default:group::--- default:mask::rwx default:other::--- # file: baseDirectory.uA7J/child_dir/grandchild_file # owner: matth # group: matth user::rw- user:www-data:rwx #effective:rw- access ACL inherited from baseDirectory./child_dir group::--- mask::rw- other::--- # file: baseDirectory.uA7J/child_dir/grandchild_dir # owner: matth # group: matth user::rwx user:www-data:rwx access ACL inherited from baseDirectory./child_dir group::--- mask::rwx other::--- default:user::rwx default:user:www-data:rwx default ACL inherited from baseDirectory./child_dir default:group::--- default:mask::rwx default:other::--- # file: baseDirectory.uA7J/child_dir/grandchild_dir/grandgrandchild_file # owner: matth # group: matth user::rw- user:www-data:rwx #effective:rw- access ACL inherited from baseDirectory./child_dir/grandchild_dir group::--- mask::rw- other::---