I created a directory, which is owned by the
www-data group. I would like to make the files in it writeable by the members of the group, no matter who created the file. My username is
pi. I tried it like this:
mkdir ./shared sudo chown pi ./shared sudo chgrp www-data ./shared sudo chmod -R 770 ./shared sudo chmod g+sw ./shared
If I check it with
ls -l, it looks like this:
drwxrws--- 2 pi www-data 4096 sept 28 17:10 shared
I created a new file in it:
cd ./shared touch ./test.txt
But if I check, the group has no write right for the new
-rw-r--r-- 1 pi www-data 0 sept 28 17:10 test.txt
What do I wrong? I can not run
sudo chmod -R 770 ./shared each time, a new file is created in the directory by a script/webserver.
How is it possible to create a shared directory, where both the owner and the group members have read and write rights for the files, regardless who created a specific file?