WordPress Permissions

April 9, 2013 4.8k views
This is my first time running my own server, and the guides on DO have been fantastic so far. I'm running Ubuntu 12 + LAMP, a pretty basic set up. I set up WordPress by creating the MySQL databases, and then uploading the WP files to the directory. I didn't do anything else. The only issue I keep running into is permissions when setting up WordPress. For example, WP Super Cache needs to write your wp-config and files in wp-content. I know setting permissions to 777 is not very secure, so is there a better way to handle permissions to allow WordPress to write and edit what it needs to without exposing my server to the world? Thanks!
3 Answers
You can check what user your Apache is running as and reown those directories to the same user as Apache, then it will have write permissions but will be slightly more secure than 777.
Ah, I did see that command in the guide to install Wordpress. I just ran the command:

sudo chown www-data:www-data * -R

and I seem to have lost all access to everything. I can't connect to any sites or databases on my server. Did I do something wrong here?
Looks like I made a big mistake - running that command in my root directory rather than the site directory. Time to start over =\
Have another answer? Share your knowledge.