Correcting your WordPress instance files and folder permissions
We often encounter issues in our WordPress instances. The issues such as permission-related errors, images are not being visible after upload, etc.
Most of the time the root cause of the issue will be a folder or file being created or uploaded or changed with a wrong file system permission.
In this article, I am giving you two commands that will correct the folders and file permissions of a WordPress instance recursively.
- You need to access the SSH terminal session of your hosting account
- Change the directory to the folder root folder of WordPress (where the index.php file is).
- Run the following two commands
find . -type f -exec chmod 644 {} \;
find . -type d -exec chmod 755 {} \;
This will give the underlying folders and files of your WordPress instance the correct permission it requires.
Note: The owner of the file should be the account user. The group should be the same user if the user is a member of the webserver group or the webserver group should be the group of the files and folders.