Ask Ubuntu is a question and answer site for Ubuntu users and developers. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I am quite new to ubuntu and I have been trying to install BuilderEngine, a content management system, to my ubuntu server 12.04 lts. I have figured some things out but I am struggling with permission for files and folders. I know I have to change the permission for folders and files in /var/www/ to be able to read and write files. But I am not sure what to do.

All I know is never use chmod -R 777 /var/www/ because that can read/write/excute files.

Was thinking of trying sudo chown -R www-data:www-data /var/www/ but not sure.

share|improve this question
up vote 5 down vote accepted

Make sure the group is www-data on '/var/www'

sudo chgrp www-data /var/www

Make '/var/www' writable for the group

sudo chmod 775 /var/www

Set the GID for www-data for all sub-folders

sudo chmod g+s /var/www

Your directory should look like this on an ls -l output.


Last, add your username to the www-data group (secondary group)

sudo usermod -a -G www-data [YOURUSERNAME]
share|improve this answer
Does this method work with ubuntu server 12.04 LTS because I only found out that it is easier to install the Builderengine cms on 12.04 version. Thanks for the quick reply – user244666 Feb 5 '14 at 1:12
Yes, this should work with ubuntu server 12.04. – Kai Feb 5 '14 at 1:27
Was able to to get into 192.168.0.xx/admin/install/index but sadly my last check box for the installation progess was unchecked it was : website folder is not writable – user244666 Feb 5 '14 at 2:10
doesn't matter fixed it – user244666 Feb 5 '14 at 2:19
Also, if you already have files inside /var/www then the change /var/www AT THE CMD to /var/www/* -R so for example sudo chgrp www-data /var/www/* -R – Yehonatan Tsirolnik Dec 2 '14 at 17:10

My Suggestion for the permission you can use below command to find and set p:

find /var/www/html/ -type d -perm 777 |xargs chmod 0755 --
find /var/www/html/ -type f -perm 777 |xargs chmod 0644 --


For Directories:

 find /path/to/your/wordpress/install/ -type d -exec chmod 755 {} \;

For Files:

find /path/to/your/wordpress/install/ -type f -exec chmod 644 {} \;
share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.