WordPress files and folder permissions in a server

Changing the hosting servers of WordPress sites is always tricky because of the WordPress files and folder permissions differ from that of a normal shared web hosting and a dedicated / VPS server.

wordpress-files-and-folder-permissions

The site may work properly but the updates won’t install or you can’t upload your image files and I have faced this issue when I moved from shared web hosting to my private VPS from DigitalOcean. I have built the hosting server from scratch on top of Ubuntu and I’ll tell you about the proper WordPress files and folder permissions required for the smooth running of your website.



WordPress File and Folder Permissions

In a private server environment, all the files should have 664 permission except the wp-config.php file which should have 660 permissions and all the folders should have 775 permissions. This can be easily achieved by running the following command in the terminal.

sudo find . -type f -exec chmod 664 {} +
sudo find . -type d -exec chmod 775 {} +
sudo chmod 660 wp-config.php

Also, make sure to delete the wp-config-sample.php and other unwanted files from your website to keep your website safe.

Raghu Chinnannan

Sign up for the blog newsletter for more articles like this.

 

3 comments on “WordPress files and folder permissions in a server”

Leave A Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.