How To Change The File Permissions In WordPress?
You often wondered that how to restrict the person to read, write, modify or access your WordPress filesystems. There are different files and directories which each have their own set of permissions specifying on who and what can hold what rights. The role counted as more important in WordPress because one may need to access to write to files in WP-Content directory in order to enable certain functions.
Permission Modes 755 and 744
It is always better to understand permission modes first before going deeper into the process. Although the permission modes range 0000 to 0777, but permission modes 755 and 744 are the most important. The permission mode is computed by adding up the values for the user, the file group and for everyone else, making you understands well that what the permission mode in actual signifies:
- Read 4 – Allowed to read files
- Write 2 – Allowed to write/modify files
- eXecute1 – Read/write/delete/modify/directory
Changing Permission Using an FTP Client
The file transfer protocol allows you to set permissions – termed as chmod or set permissions in the program menu – for both files and directories on your remote host. There are two files in a WordPress install which you will probably want to alter are the index page and the CSS controlling the layout.
- To do the changes you need to do it in your theme’s index.php file while remember here that the process is same for any file.
- Now, notice on the last column – you will notice something like saying –rw-r-r- and similar – this represents permissions.
- Right click on the “index.php” file and select “File Permissions” will open up window for you from where you can change the permission.
- Doing above, a popup screen will appear.
- Now, just delete the ‘Numeric value:’ and enter the number you need while don’t worry about the check boxes. Once done, click OK and you are done.
Changing Permission Using The Command Line
- If in case you are having shell/SSH access to your hosting account, then you can use chmod to change file permissions although remember here that the method is mainly best for experienced users only.
- Only two steps will lead towards making all the files in your WP-Content directory writable, but it’s still advisable to opt for safer alternative as doing one step wrong will take your whole site offline.
- Try to modify just the directory – each of these commands first but if in case it does not work, and then go for recursive, which may make your themes files also writable. This can be done by replacing DIR with the folder you want to write in.
- If those all fails, try them again in order with replacing –v with –R.
Photo Credit: Flickr/wiredforlego