I recently ran into an issue where a previously working WordPress website was not updating. Plugins, Themes, Core software, just not working. Needless to say it was quite infuriating.
I spent some time manually updating which was just too time consuming but I didn’t have time to trace the error and find the problem. Once done I spent some time finding a fix for the problem. If you have issues with WordPress permissions when updating plugins, themes, and core software follow some simple steps to help solve your problem!
The Guide
Step 1 – Login to your Server
This guide requires that you have SSH access to your server. Login through your normal method. I typically just switch to the root user once I am logged in.
$ sudo -s
We need to reset the permissions of the WordPress website so that we can make things work properly again.
First lets change all of the files back to a secure setting:
$ find /path/to/site/ -type f -exec chmod 664 {} \;
This command finds all regular files inside the directory where our site is located and changes them to have permissions of 664. Be sure to change /path/to/site to be the path to your website. Typically this is /var/www/html/
$ find /path/to/site/ -type d -exec chmod 775 {} \;
This command finds all the directories in your site path and changes the permissions to 775.
$ chgrp -R www-data /path/to/site/
This command changes the group owner for our website. We need this to be the same as whatever our web server is using to run. In most cases this will be www-data. Below is a command you can run to detect what user your web server is using.
$ ps aux | grep apache
This will find Apache running on your system
$ ps aux | grep nginx
This will find NGINX running on your system
$ ps aux | grep httpd
This will find Apache running as httpd. Typically this is on CentOS servers.
$ chmod 777 /path/to/site/wp-content/upgrade/
I was still having issues with upgrading so I gave my upgrade folder open permissions. When you are done upgrading I suggest changing this permissions back to 775.
$ chmod 777 /path/to/site/wp-content/plugins/
This command is similar to the upgrade folder but we are modifying the plugins folder to have open permissions. This was also needed for my server. It may not be for you.
Conclusion
This guide shows you how to resolve some permissions errors within WordPress. Hopefully this has helped your fix any issues you might have been having with your website.
If you are still having problems feel free to reach out to our team for assistance!
If this guide has been helpful for you and your team please share it with others!