Setting permissions for wordpress

Posted November 5, 2013 169.9k views
I installed wordpress on lamp and cannot update themes or install plugins. I get an "unable to create directory" error when I try to. When I spoke with support they told me to do this: root@domain:~# chown -R www-data /var/www/wordpress but what I got was this: chown: cannot access `/var/www/wordpress': No such file or directory So, I was told to find where wordpress was installed but my understanding is that according to the tutorials here on DO its installed in home and then moved to /var/www Can anyone help with this? Thanks!

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
16 answers
sudo chown -R www-data:www-data /var/www

Everyone experiencing this issue should execute these commands:

sudo usermod -aG www-data $USER

Adds the currently logged in user to the www-data group.

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

Changes the ownership of the /var/www directory to www-data group.

sudo chmod -R 774 /var/www

Sets the proper permissions so you can upload files via sftp, manage files via command-line, and upload plugins and media directly in WordPress.

The following is not aimed toward the original poster, but toward a couple of the comment authors:

If this doesn’t fix the issue you’re having, you’ve got something else wrong and bashing DO is not going to help anyone. If you want a managed server, look for hosting elsewhere. If you need help, ask someone or hire an admin that knows how to not only ‘set things up’ but knows how to secure your server as well. You’ll be glad you did. DO is not for novices, even if they have a lot of tutorials.

"I installed wordpress on lamp..."

How? Did you follow a guide? If so, which one?

"... but my understanding is that according to the tutorials here on DO its installed in home and then moved to /var/www"

Not all tutorials take that approach.

Also, the command you need to execute is:
sudo chown -R www-data:www-data /path/to/WordPress/Installation
  • Sorry, for dumb question… Is it safe and right way to give all the permissions to apache for hole catalog of the site ? I’m new to it. I had the similar issue and fix it in the same way, but i’m not sure if is it right …

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

Errors out my site completely (500)

This is super annoying. All I want to do is be able to migrate a Wordpress site to a Digital Ocean droplet and have it work without spending days on it!
@jason: What webserver and OS are you using? The point is to make the files owned by the same user that is running the webserver.


For anyone on a Red Hat Linux or CentOS server, the owner:group needs to be


instead of


Hope this will help others using/stuck with RHEL.

Show answer This answer has been marked as resolved by feb.

Thanks for the reply. This is the tutorial I used:

When I access the site through ssh/sftp the wordpress installation is located:

So why isn't it working since that is /path/to/wordpress/installation or am I wrong?


by Etel Sverdlov
WordPress is a free and open source website and blogging tool that uses php and MySQL. It was created in 2003 and has since then expanded to manage 22% of all the new websites created and has over 20,000 plugins to customize its functionality. This tutorial shows how to install WordPress on a server with LAMP. It is written for Ubuntu 12.04.
That fixed it!

Thanks a lot Pablo!

I am having similar issues. My expectation is when I install WP through the DO admin it should just work. I can’t use migration plugins because there are file permission issues in default install of WP. I can’t upload plugins because there are file size upload limitations. I can’t run certain things because curl isn’t working out of the box.

I love the speed and performance but this has been a nightmare trying to migrate simple WP sites.

Previous 1 2 Next