I’ve been working on a WordPress project lately that is housed on an Amazon EC2 server, using Bitnami. Overall, it’s a pretty awesome setup, giving me total free reign to setup the server how I need. Everything worked great on the QA server, but for some reason, after we moved the code to the production server, users started complaining about the inability to post any media (images, video, etc.) to their posts. They were getting a permissions error in WordPress trying to create the upload directory.

My initial thought was to use chmod to give all users write permissions to the folder in question. This couldn’t be done, however, as it opens up an obvious security hole.

So Next I checked out the QA site, and realized that the user and group owning the htdocs directory were daemon and bitnami, respectively. This was not the case on the prod server. So it became obvious that WordPress was hitting this directory as the daemon user, and did not have ownership rights to it. So I gave it to them:

Bash

chown -R daemon:bitnami /opt/bitnami/apps/wordpress/htdocs

And viola! The issue was resolved. This little jaunt down the rabbit hole, however, got me thinking about permissions as a whole when it comes to WordPress. I did some further reading and came across this great article regarding security on the wordpress platform. I highly suggest you give it a look.

If you only care about the meat and potatoes, as most developers often do, these two snippets are what you want. If you have shell access to your server, you can change file and folder permissions recursively with these bad boys, and set them to the correct permissions the WordPress team suggests.

For Folders:

find /path/to/your/wordpress/install/ -type d -exec chmod 755 {} ;

For Files:

find /path/to/your/wordpress/install/ -type f -exec chmod 644 {} ;

Good luck!