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?

1 Answer 1


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.

  • Wouldn't the sticky bit for the group solve his needs?
    – jjmontes
    Feb 19, 2012 at 20:10
  • 2
    @jjmontes - I don't believe so, since he talks about chmod rather than chown. Rereading, though, it could be that was a typo for chown, and the sticky bit would solve the problem. That would be chmod g+s /path/to/directory Feb 19, 2012 at 20:13
  • @Daniel Pitteman:Sorry I did mean chown not chmod :)
    – James
    Feb 19, 2012 at 20:48
  • Then @jjmontes was on the money. Use the sticky bit on the directory to get the behaviour you want. Feb 19, 2012 at 20:52
  • Yes the ACL stuff worked. I used this specific command: setfacl -R -m d:u::rwx,d:g:homework:rwx,o::- /home/Homework
    – James
    Feb 19, 2012 at 21:18

You must log in to answer this question.

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