Who should be the owner of files in /var/www/ me, as the only user on the server, or www-data?
by Pedroski from LinuxQuestions.org on (#5QN8N)
Setting up a Ubuntu 20.04 Server on a cloud server.
From this site I am told
Code:sudo mkdir -p /var/www/example.com/public_html
sudo chown -R $USER:$USER /var/www/example.com/public_html
sudo chmod -R 755 /var/www/example.com/public_html
sudo chmod -R 755 /var/www/example.com/public_html
sudo find /var/www/example.com/public_html -type d -exec chmod g+s {} \;Another "set up a virtual server" site told me I should make www-data the owner of all files.
What would you recommend?(I have never had a cloud server before)
At home, on my laptop, I sometimes get "permission denied" error in apache error.log, so then I run the following, which were recommended to me here on LQ:
Code:sudo chown -R pedro /var/www/html
sudo chgrp -R www-data /var/www/html/
sudo chmod -R 770 /var/www/html/
sudo chmod g+s /var/www/html/
From this site I am told
Code:sudo mkdir -p /var/www/example.com/public_html
sudo chown -R $USER:$USER /var/www/example.com/public_html
sudo chmod -R 755 /var/www/example.com/public_html
sudo chmod -R 755 /var/www/example.com/public_html
sudo find /var/www/example.com/public_html -type d -exec chmod g+s {} \;Another "set up a virtual server" site told me I should make www-data the owner of all files.
What would you recommend?(I have never had a cloud server before)
At home, on my laptop, I sometimes get "permission denied" error in apache error.log, so then I run the following, which were recommended to me here on LQ:
Code:sudo chown -R pedro /var/www/html
sudo chgrp -R www-data /var/www/html/
sudo chmod -R 770 /var/www/html/
sudo chmod g+s /var/www/html/