I have set up 4 websites inside the /var/www/html/ folder.
The account I use to access the server is through my account
Now the permissions are root:www-data with 755 and supposed to be recursive. However, when uploading data from my account harleyfrank, it just sets permits for me, and I get an apache error because of the permissions.
I followed these websites:
- how to set permissions for all only files and for anly folders in the publick_html?
- Setting Default Permissions
But the weird thing is that it is applying harleyfrank:www-data with read-write permissions only to harleyfrank. I am not sure how to get it fixed.
Following George's answer, I tried to do a global set
sudo setfacl -d -R -m u:root:rwx,g:www-data:rw,o::r /var/www/html however, it's not applying the permissions. It is still only using my username when uploading files.
Here is what the permissions are set by the ACL:
getfacl: Removing leading '/' from absolute path names # file: var/www/html # owner: root # group: www-data user::rwx group::rwx other::r-x default:user::rwx default:user:root:rwx default:group::r-x default:group:www-data:rw- default:mask::rwx default:other::r--
In one of the web folders I did
ls -la and here are the results.
drwxrwxr-x+ 3 root www-data 4096 Jan 15 19:52 . drwxrwxr-x+ 6 root www-data 4096 Jan 12 21:35 .. -rwxrwxr-x 1 root www-data 169 Jan 12 22:05 index.html drwxrwxr-x+ 9 root www-data 4096 Jan 12 23:16 projects -rw-rw-r--+ 1 harleyfrank harleyfrank 871 Jan 15 19:52 test_results.txt
I uploaded test_results.txt, and it is not reading within apache as it says I do not have permissions to view the file. However, it shows read permissions in the other's group. Maybe apache2 is running everything with www-data?