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

Posted February 19, 2015 4.8k 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.

These answers are provided by our Community. If you find them useful, show some love by clicking the heart. If you run into issues leave a comment, or add your own answer to help others.

Submit an Answer
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: