I have the directory /data which I want to share with all the users from the datagrp group. I have set all the permissions and right now I have

drwxrwsr-x 2 root datagrp 4.0K Apr 22 14:52 /data

Now all users can read and write there, which is okay. However, if user usera creates a folder /data/a then the other users cannot write into it, unless I manually set the permissions. I would like this to be automatic, meaning that everything that is inside /data can be seen and modified by any user from datagrp. How can this be done?

I have already tried

sudo chown :datagrp /data/
sudo chmod 770 /data/
sudo chmod g+s /data/


sudo setfacl -dm u::rw,g::rw,o::r /data

2 Answers 2


Either, one works with ACL or users need to configure their umask appropriately (which could be set per user per shell, to make things more "interresting"). If one chooses to use posix permissions, a possibility could be to change the permissions via cronjob regurlarly. umaks 002 would set the umask, so that files and directories are created with group-write-permission in that shell. setfacl -m default:group:datagrp:rwx /data might do the trick if one wants to use ACL.

  • If I run your setfacl and usera creates a /data/A, then userb can enter in /data/A and create /data/A/B but usera cannot enter in /data/A nor create anything in there.
    – user171780
    Commented Apr 22 at 14:30

This answer solved my problem. For quick reference:

sudo mkdir /data # create the directory
sudo chown :datagrp /data
sudo chmod 770 /data
sudo chmod g+s /data
sudo setfacl -Rm g:datagrp:rwX /data # Add an ACL with rwx permissions for the group to all the files already there
sudo setfacl -d -Rm g:datagrp:rwX /data # Add a default ACL with rwx permissions for the group usershare for all files created from now on

You must log in to answer this question.

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