I want to create a directory where multiple users will be able to contribute to the same files and I want each file that any user creates to have write permission by default for everyone in the group.
I did setgid for a directory and all new files have the right group. However new files are still created without write permissions in the group.
Here is an illustration of what I'm trying to do:
(as a root user):
mkdir --mode=u+rwx,g+rws,o-rwx /tmp/mydir chown root.mygroup /tmp/mydir touch /tmp/mydir/test.txt
Then when I do
ls -la /tmp/mydir/ I'm getting
drwxrws--- 2 root mygroup 4096 Sep 12 12:04 . drwxrwxrwt 11 root root 4096 Sep 12 12:04 .. -rw-r--r-- 1 root mygroup 0 Sep 12 12:03 test.txt
So, write permission never gets populated for a group for all new files authored by members of that group. I understand that other group users still can override that by doing
chmod g+w for specific files such as
test.txt in the example above and this is the right behavior in most of the cases, but is there a way to recursively alter that for a specific directory and allow write permissions to be automatically set for a group as well as the owner for all new files within that dir?