Here's how I am setting permissions for my website's root directory i.e.
~/public_html, where the files that my website serves are placed:
sudo chgrp -R www-data ~/public_html chmod g+s ~/public_html chmod g+rwx ~/public_html setfacl -m d:g:www-data:rwx ~/public_html
- Command #1 gives "www-data" group ownership access to
- #2 sets the group ID, so that all new directories/files within are also owned by "www-data" group
- #3 sets access permissions for the group "www-data" on the directory to 775;
- #4 makes sure that the same apply to all new directories/files created within
It's working great, as it should. All new created directories and files inherit the forced permissions.
The problem is with directories created by
git clone (after I do
cd ~/public_html && git clone ....).
UPDATED: The directory DOES inherit the group ID (i.e. "www-data" owns the newly created directory), BUT NOT the access permissions (775 for directories and 664 for files). Also, it's just the top-level directory that git creates. Every directory and file withing inherit permissions just as they should. Could it be that the Debian git package doesn't have the fix for this bug yet?
What am I doing wrong? Rather, how exactly should I be doing it?