Linux – Inherit or set permissions for all new files under a specific path

access-control-listlinux

I would like the Linux filing system to set a specific group when new files and directories are created by different users under a specific directory. I know I can use chown to change existing files and directories but I want it to happen automatically. Does anyone know how?

Best Answer

The standard user/group/other security model in Unix doesn't support this. The closest you can get are the "sticky" bits to assign ownership and group to newly created files.

However, you tagged this acl, and that might open the door: you can set a default ACL that will be inherited down the tree; see the -d switch to setfacl(1), and the details under "automatically created entries" in the same manual page to understand how that works.

http://www.vanemery.com/Linux/ACL/linux-acl.html#default has further examples of how to use these tools.

If all you needed to do was make sure new things got created with a specific directory, though, that is much easier:

chgrp some-group /path/to/directory
chmod g+s /path/to/directory

That has no influence over file mode, just file ownership.