What should be the right user/group permission for website files at /var/www/?


#1

Is it chown www-data:www-data ? Cause I just want to add crontab to automatically fix permission and just use user root for sftp upload.


#2

Stock / standard EasyEngine is www-data:www-data

We actually do [user]:www-data with a specific user as owner for servers that have more than one site on them; and have scripts to chown to www-data:www-data for updates, etc and then back to [user]:www-data after updates.


#3

So it’s safe to modify htdcos files, upload new files using root account?


#4

Def would not leave root as owner.


#5

What do you mean by that exactly? :confused:


#6

If you upload the files as root, don’t leave root as the owner of the files. Change them to www-data or another user.


#7

OK, I will just create a cron to set them automatically:

*/5 * * * * /bin/chown -R www-data:www-data /var/www/

#8