Setting permissions for wordpress

  • Posted November 5, 2013

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?



Submit an 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.

Execute: <br><pre>sudo chown -R www-data:www-data /var/www</pre>

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.

<b>“I installed wordpress on lamp…”</b> <br> <br>How? Did you follow a guide? If so, which one? <br> <br><b>“… but my understanding is that according to the tutorials here on DO its installed in home and then moved to /var/www”</b> <br> <br>Not all tutorials take that approach. <br> <br>Also, the command you need to execute is: <br><pre>sudo chown -R www-data:www-data /path/to/WordPress/Installation</pre>


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.

you can manually check where your wordpress has been installed using ls command or use ftp

I have it, in the path /etc/php/7.4/apache2/php.ini find this variable in the document and change the value upload_max_filesize = 64M post_max_size = 64M memory_limit = 400M file_uploads = On max_execution_time = 300 max_input_vars = 3000

darice answer solved for me as well… was moving a wordpress instance and not building new.

I have the same problem. I tried everything above and nothing works. Plugin install works, WordPress automated update works but uploading a media file fails no matter what I try, I keep getting:

Unable to create directory uploads/2017/11. Is its parent directory writable by the server?

My permissions are set to drwxr-xr-x and www-data www-data I added my user to www-data. I restarted the Apache server several times. Nothing helps. I even tried a chmod 777, nothing.

My setup is Ubuntu 16.04 with Apache2, PHP7, mySQL5 and Let’s Encrypt.

Any idea what is going wrong here?


Well, solved it! For others who might have the same issue:

I moved my WordPress install from an old server. In case of moving a setup instead of clean install you need to change the path in dashboard->Settings->Media to your absolute path. E.g.


After trying many options, changing folder permissions fixed my Wordpress Permalinks issue. I hope this can guide other aspiring professionals as well.

I have the same problem, but Once I used this command sudo chmod -R 755 /var/www, one application of the server crashes, so I’m afraid to use commands for change permisions for the other apps that i have… What solution any of you recomend me, because the wordpress it’s installed like a sudbomain in my droplet, and I have many differents apps there.

I don’t want to do a mistake , but i need to install plugins and new theme for a blog, please help me