Report this

What is the reason for this report?

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

Posted on February 19, 2015

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.



This textbox defaults to using Markdown to format your answer.

You can type !ref in this text area to quickly search our full set of tutorials, documentation & marketplace offerings and insert the link!

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.

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

and:

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:

http://blog.netgusto.com/solving-web-file-permissions-problem-once-and-for-all/

The developer cloud

Scale up as you grow — whether you're running one virtual machine or ten thousand.

Get started for free

Sign up and get $200 in credit for your first 60 days with DigitalOcean.*

*This promotional offer applies to new accounts only.