Setting Up File Permissions in WordPress to prevent from Malware Attack

WordPress is one of the best open source platforms that is used for blogging worldwide. If you are a Blogger, either you’re using WordPress already or if you haven’t, well I’d suggest you to use WordPress for your blog as there’s a whole lot of community of people who are there for you to solve your queries and lead you to a blogging success. However with the increase in number of users, increases the threat which is a well known fact.

In fact, my blog was hacked and filled with malware a while back and I had to sit and resolve the issue. While doing so, I thought why don’t I make a draft of what I did and write it down my blog. So, here’s one step that I followed to fix the Malware Attack and if you are doing it right, you will be able to prevent future attacks for that matter.

Setting up Permissions :

This is an important step to be followed, I’d say the first step that you would need to do for your WordPress blog. It is to set up the files and folder permissions for your blog.

The basics is that the files should have 644 file permissions and folders should have 755 folder permissions.

Assuming you have SSH or SFTP/ FTP access to your hosting server, you can achieve this using the following commands.

For Directories

{wp installed folder} >> find . -type d -exec chmod 755 {} \;

For Files

{wp installed folder } >> find . -type f -exec chmod 644 {} \;

Now, the above commands will change the file and folder permissions recursively throughout the whole application.

This is it. This will secure your files and folders to a certain extent and there are other steps and methods of securing your WordPress blog. I will be writing down those steps in the coming days and will tag the link along with this post.

Comment below if you have any issues doing this, I’d be happy to help.