Ubuntu add user to www-data and set permissions

This is just a small blog post. I tend to forget these commands.
Make /var/www writable without sudo privileges.
1. Add user to www-data group
2. Add /var/www to www-data (recursive)
3. Change file and folder permissions on /var/www (recursive)

sudo adduser username www-data
sudo chown -R www-data:www-data /var/www
sudo chmod -R g+rw /var/www


  1. I’ve problem with my laravel fresh new installation, i can’t access public folder from my localhost. Then i use this method and it work like a charm!

    Can i post it on my personal blog, i’ll link back the reference link to your blog. Thanks very much sir!

Leave a Reply

Your email address will not be published. Required fields are marked *