I can't seem to grant myself write permissions to the /www/ directory?

February 19, 2015 1.5k views

I've been trying via SSH to grant my user 'demo' write permission to the var/www/ directory (to manage server pages). Filezilla keeps feeding back the error:" Directory /var/www/html/: permission denied". How can I fix this? I'm running Ubuntu with a LAMP stack.

1 comment
1 Answer

You might try adding your user to the www-data group:

sudo usermod -aG www-data demo

and then to be sure:

sudo chown -R www-data:www-data /var/www


sudo chmod -R 775 /var/www

Having said that, doing it that way will work, but when you use "demo" to add new files, then www-data will not have ownership of those files.

I recently read a great little article with an eloquent solution that took 5 minutes to implement and works like a charm:


Have another answer? Share your knowledge.