WordPress Development Stack Exchange is a question and answer site for WordPress developers and administrators. 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'm hosting a local version of my wordpress theme on Ubuntu 11.10. However, LAMP is installed in a directory that requires sudo privileges. When I try to add images or any outside content to my theme, it fails because it cannot create a folder/write to a folder.

How do I edit the permissions to allow Wordpress the access it needs?

share|improve this question
This should be asked in askubuntu.com – Wyck Mar 20 '12 at 22:43
Can you login to terminal? This should be over in serverfault. Navigate to /var/www/ and do ls -l – AlxVallejo Mar 20 '12 at 22:50
up vote 4 down vote accepted

I think that setting all to 777 is not the most secure option.

Basically, my favourite is to change the wordpress to the webserver's owner. Being:

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

So that the webserver is responsible for handling changes.

Also, you can change the rights to 755 for the whole /var/www branch

sudo chmod -R -c 755 /var/www/ 

Finally, allow your wp-content/ folder in 775 ( so that you can edit files from the WordPress backend without having to upload files via FTP. ( Not necessarily a best practice but useful from time to time ) via

sudo chmod -R -c 775 /var/www/WORDPRESS/wp-contents/

And you will have a reasonable setup with uploads, editing from backend and a minimum level of security.

share|improve this answer
Sorry I never accepted your answer. I just happened to stumble across it. It helped me at the time and its continued to help me to this day! – Colton Allen Feb 25 '13 at 17:00
Awesome. Glad to help. Thanks for the feedback. – nembleton Feb 26 '13 at 3:18
Should the first one be sudo chown -R $USER:www-data /var/www or the way you suggest it? DigitalOcean recommends this way. What is the difference? – JFA Jun 18 '14 at 19:26
Ok, www-data:www-data worked, but I thought I read that this lowers security. I read another solution that said to add define('FS_METHOD','direct'); to wp-config.php here – JFA Jun 18 '14 at 19:52

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.