I am going to ask a question that has already been posted many times but even though I have read many guides and posts, I still have doubts.
I have a server with ubuntu 14.04 on which I have a user with sudo permissions (secondary group "sudo") and a user who just want to use for the "web server".
I will explain in detail...
My webserver user is "jack" and this is part of the group www-data (as the primary group)
The virtual hosts point to the jack's home directory where I created a subfolder called "alias" which contains subfolders with the various sub-domains
es.
/home/jack/public_html <-- main site
/home/jack/alias/forum <-- subdomain
/home/jack/alias/wiki <-- subdomain
/home/jack/alias/cloud <-- subdomain
What I would like to know is:
- first question-
Is correct that jack belongs to the primary group www-data instead of belonging to the group users, and as a secondary group www-data ?
- second question-
A friend advised me to set the permissions on the web server folder in this way
chgrp www-data /home/jack/public_html
chmod g+rwxs /home/jack/public_html
And the same for the alias folders. Now it seems to work but there is a problem....
- If I load a file in the web server root permits are
jack:www-data 0644
- If the files are generated by www-data (for example through a cms)
www-data:www-data 0666
Now, if I edit a file manually, for example via ftp, this changes the permissions and creates problems to the various "web app"
How can I do to fix it?
chgrp www-data ...
andchmod g+rwxs
commands recursively? those permissions need to be on every single file and folder in the document root the webserver has access to. Secondly are you actually running as userjack
and alsojack
should belong to groupwww-data