Question

I just set up a debian box as a local-only lamp server. I need to know how to set up permissions (and possibly ownership?) on my /var/www folder so that I can have full control over that folder from my main user account (not root/su).

I am somewhat familiar with the chmod command but if you could provide code examples that would be great!

Was it helpful?

Solution

You could include yourself in the www-data group and change the ownership of the directory. Example:

$ sudo adduser you www-data
$ sudo chown -R www-data.www-data /var/www
$ sudo chmod -R 770 /var/www

OTHER TIPS

Find out the Apache group and add yourself to the same group. Check that the /var/www folder's group is set to the same (should be)

Good luck.

Wordpress users are who struggle with this issue. Well, I found that adding the user root to www-data can solve this problem. You may have to try adding yourself instead of root.

usermod -a -G www-data root

You can also see a simple three-step method in this post below if the above post didn't work for you.

https://askubuntu.com/questions/635522/file-permission-problem-on-ubuntu-lamp-server/1187503#1187503

or, https://www.techify.club/2019/11/09/fix-linux-lamp-server-permission-issues-ultimate-fix-2020/

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top