WordPress permissions or ownership

Posted by & filed under Linux, Wordpress.

I was recently trying to upload a plugin to WordPress and found that the plugin could not create a directory. The problem was not directory permissions – it was user/group ownership.

PHP running as fastCGI is running as user nobody on my VPS. I tried changing directory perms to 777 for wp-content/uploads and wp-content/plugins but this did not make any difference. Then I 777 the whole wp-content directory – no joy.

Then I tried changing the user ownership of the wp-content directory… this, suprisingly, did not work. In the end I changed the user and group ownership of the whole public_html directory recursively to nobody.nobody. This worked.

If I had longer to mess about I could no doubt figure out which directories/files were responsible as changing the ownership of everything is overkill.

One thing to note: when changing back ownership to the correct user, I had to make sure the root directory (public_html) was user correct_user and group nobody.

chown correct_user.nobody public_html

Otherwise the whole site went offline! This is because httpd process is running as nobody.

List files by permissions and owners:

ls -l

Find files/directories owned by a particular user:

find -user myuser

or a particular group:

find -group nobody

or files beginning with “wp-“:

find -group nobody -iname wp-*

To change the group or user, use chown:

chown theuser some_dir

To change both user and group, recursively:

chown -R theuser.thegroup some_dir

This link is useful: http://www.cyberciti.biz/faq/how-do-i-find-all-the-files-owned-by-a-particular-user-or-group/

Leave a Reply

  • (will not be published)

XHTML: You can use these tags: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <s> <strike> <strong>

Bitnami