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:
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