I create couple websites on my home web server. In some articles I found that I have to use : sudo chown -R $USER:$USER /var/www/your_domain
other sources recommend to use: sudo chown -R www-data:www-data /var/www/your_domain
. Which one is right?
1 Answer
In the first command, $USER
is the UNIX user (probably your currently logged in account). This isn't correct, you want to specify the web server user and assign permissions to them, since that's the user that will actually need to read this data. For Apache, the default web sever user is www-data
so the second command is the correct one.
However, if you named your web server user something else, let's say webadmin
then you'd want to do:
sudo chown -R webadmin:webadmin /var/www/your_domain