9

We are moving our web files from AFS to a local volume with the acl flag set. We use extended ACLs for our permissions so users can edit different parts of our websites. In AFS, when you create a new file it inherits its parent's permissions.

How do we make it so that when users create new files in their web directories, those files inherit the parent's facl? (Which includes www-data) If it helps, we run Gentoo Linux.

3
  • what filesystem are you using in your local volume?
    – c4f4t0r
    Commented Nov 25, 2013 at 23:15
  • ext4 (with the acl flag in fstab)
    – Vacation9
    Commented Nov 25, 2013 at 23:22
  • if you check my answer you can see a link some example
    – c4f4t0r
    Commented Nov 25, 2013 at 23:24

1 Answer 1

11
+100

On Linux, many filesystems support posix acl.

If you have many directories and you want to apply the acls on subdirs

 -R, --recursive
       Apply operations to all files and directories recursively. This option cannot be mixed with ‘--restore’.

But if you want the acl are apply on files and directories on creation time, you need the defaults acls on directory

 setfacl -d -m user:user01:rwx dir
5
  • We are using posix/extended acls. What we want to do is have these apply recursively, as normal acls do, upon creation of a new file in that directory.
    – Vacation9
    Commented Nov 25, 2013 at 23:27
  • Alright, if new directories are created in the directory with default acls set will they also inherit those defaults? Or will the defaults apply at any depth?
    – Vacation9
    Commented Nov 25, 2013 at 23:49
  • 2
    yes, i tried now and i can tell it work, if you set the default acl on a directory, the subdir inherit the acl from parent dir and default too
    – c4f4t0r
    Commented Nov 25, 2013 at 23:53
  • 1
    Note that this will work for new or copied files, but not for moved files. Moving keeps the existing ACLs, even if the destination has "default" ACLs set on it... Commented Jan 28, 2019 at 12:44
  • the accept answer no longer works on Linux. Running it results in either root@SmolLinuxBox:~# setfacl -d -m www-data:www-data:rwx /mnt/PrimaryDisk1/public_html/ setfacl: Option -m: Invalid argument near character 11 or root@SmolLinuxBox:~# setfacl -d www-data:www-data:rwx -m /mnt/PrimaryDisk1/public_html Usage: setfacl [-bkndRLP] { -m|-M|-x|-X ... } file ... Try 'setfacl --help' for more information. Commented Sep 1, 2023 at 23:40

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .