Question

WordPress Permissions

  • Posted on April 9, 2013
  • msomersAsked by msomers

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!


Submit an answer

This textbox defaults to using Markdown to format your answer.

You can type !ref in this text area to quickly search our full set of tutorials, documentation & marketplace offerings and insert the link!

Sign In or Sign Up to Answer

These answers are provided by our Community. If you find them useful, show some love by clicking the heart. If you run into issues leave a comment, or add your own answer to help others.

Hello there,

These commands should set the correct permissions for your site.

  1. sudo find /var/www/wordpress/ -type d -exec chmod 755 {} \;
  2. sudo find /var/www/wordpress/ -type f -exec chmod 644 {} \;

Usually, you’ll have 750 permissions for your directories and 640 for the files. However, in some cases, this won’t be sufficient.

You need to update the path for the WordPress directory to match the path of your WordPress installation.

These permissions should get you working effectively with WordPress, but note that some plugins and procedures may require additional tweaks.

Regards

Looks like I made a big mistake - running that command in my root directory rather than the site directory. Time to start over =\

Ah, I did see that command in the guide to install Wordpress. I just ran the command: <br> <br>sudo chown www-data:www-data * -R <br> <br>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?