The official recommendation from WordPress for the permissions of the installation directory is:
- Owner: Read, write, and execute.
- Group: Read and execute.
- Others: Read and execute.
For files, the permissions are as follows:
- Owner: Read and write.
- Group: Read only.
- Others: Read only.
Additionally, it is recommended to change the permissions of the wp-config file to read-only for the owner. You can review this in the official WordPress documentation by clicking here.
Directory and file ownership
If you use another user to perform certain actions in the directory, this may cause the owner/group to change. In that case, you will need to change it back to the Web user.
To change directory ownership recursively, you can run:
# chown -R www-data:www-data /var/www/html/wordpress
The Web user and path shown are those used by default by the preinstalled WordPress image. If you installed WordPress in a different directory and/or use another user, you will need to modify the example command.
Directory and file permissions
If the permissions are changed, you will need to correct them to ensure proper operation and security. To do this, first access the WordPress directory:
# cd /var/www/html/wordpress
Change the permissions of the files within the directory with the following command:
# find . -type f -exec chmod 644 {} \;
Then change the permissions of the directories by running:
# find . -type d -exec chmod 755 {} \;
Finally, following the recommendation, change the permissions of the wp-config file:
# chmod 400 wp-config.php
We hope this article has been helpful. If you have any questions about this or any other issue related to your servers on Clouding, please do not hesitate to contact soporte@clouding.io. We are here to help!