Question

Apache permissions with WordPress on CentOS 7

I’ve set up dozens of CentOS servers before, so this one is baffling me to say the least…

I’ve got a “nothing fancy” LAMP stack running on a CentOS 7 droplet. I’ve got a VirtualDirectory configuration running a WordPress site that I’ve run on other hosts for many years, and it’s never given me a problem before. I’ve transferred it here, and have tried to install a plugin through the UI.

I get the “FTP login” screen (which I’ve never seen before). I’ve tried using chmod -R g+w on the wp-content folder (which I’ve never had to do before), I’ve set define(‘FS_METHOD’, ‘direct’); as well. I’ve tried setting the apache user SSH keys. None of them solve my problem.

I thus must assume that I’ve got an Apache and/or a UNIX user config issue. But I can’t seem to find it.

Any pointers and/or hints would be greatly appreciated!

Cheers, Geoff


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.

Want to learn more? Join the DigitalOcean Community!

Join our DigitalOcean community of over a million developers for free! Get help and share knowledge in Q&A, subscribe to topics of interest, and get courses and tools that will help you grow as a developer and scale your project or business.

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

Hi Geoff,

The permissions you need will depend on which user Apache is running as. I found this article from Smashing Magazine, a while back, which does a great job at explaining exactly which permissions WordPress needs in order to run properly. I recommend it a lot in Support tickets, as well as to my friends who are seeing that dreaded FTP upload screen. Hopefully it helps you out!

The main takeaway from it is, on a VPS like your Droplet:

www-data (or whichever group the webserver is running as) should have group permissions for all of the WordPress files.

All files should be 664 All directories should be 775 wp-config.php should be set to 660, so “other” users cannot see sensitive information in that file.

Of course, this is only for a private environment like your Droplet. If you’re using the droplet to host multiple users, you’ll need a slightly different setup (also detailed in the article I linked above).

I hope that helps. Please let me know if you need any further help with this. :)

Best, Eris Platform Support Specialist