Wordpress file permissions

July 14, 2014 5.3k views

OK.. I have 2 users for my droplet
root (unused)
user (user with all privileges, obviously not the real name)

However, I chowned wp-content/uploads to user and chmodded it to 775

Wordpress is unable to uplaod anything unless I change permissions to 777

Any pointers?

6 Answers

Wordpress most likely runs as the user "www-data", so you will need to allow it to write to wp-content/uploads.

Since the directory already allows the members of the group that owns it to write to it (775), you just need to change its group ownership to the www-data group:

sudo chgrp www-data wp-content/uploads

Make sure you apply it recursively so that it can write to its subdirectories as well:

sudo chgrp -R www-data wp-content/uploads
sudo chmod -R g+w wp-content/uploads

Sorry to bump thread, but quick question on similar issue myself.

Installed WordPress and LEMP using the brilliant EasyEngine setup, however facing familiar problems when trying to upload/migrate existing files/folders to WordPress (wp-content etc).

I have created a root-privileged user for myself using a separate SSH port etc, however I want to know one thing.

I tried much of the tips advised such as "sudo chgrp www-data wp-content/uploads" to no avail.

I then added this line: sudo chown -R myusername:www-data /var/www/*

It seems to work fine - I can upload plugins etc, however I want to know if it is safe. Is there any downfalls to using that approach, or should I avoid it?

I found it on a Google search where people using Apache used it, however, does it make a difference considering I'm using Nginx?

Thanks a lot, and sorry again for rising a settled thread!

  • Yes, that's great way to do that if by "root-privileged user" you mean that the user has sudo privileges.

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

worked perfectly fine for us on our website http://www.reckontalk.com

Have another answer? Share your knowledge.