Files and Folders Permissions are very essential steps when it comes to hosting your Wordpress, Drupal or any Script online on your server. Permissions allow server computer to read, write and edit your files/folders. Simultaneously, some file’s permissions need to be changed into protected mode from writing and editing, as a security measure.
Common errors Seen on Wordpress, Drupal and other scripts caused due to File permissions which fails to meet Scripts requirements:-
Anybody may do anything. Least secure, the user should only use these settings if they know what they are doing.
The file's owner may read, write, and execute the file. All others may read and execute the file. Appropriate when you have programs or scripts that must be executed by non-owner users.
The file's owner may read, write, and execute the file. Nobody else has any rights. This setting is useful for programs that only the owner may use and must be kept private from others.
All users may read and write the file.
The owner may read and write a file, while all others may only read the file. A common setting for data files that everybody may read, but only the owner may change.
766 Read and Write. Works well for cache folders or upload folders where content must be written, but not executed. It means that the directory is readable and writable by WordPress and all other users on your system.
You can change your file permissions easily by following certain steps which are as follows:-
Using File Manager in cPanel
- Login to your cPanel
- Click -> File Manager
- Click -> File name for which you would like to alter the permissions.
- Select-> Change Permissions link at the top right of the page.
- Select-> the permissions you would like to set for the file.
A common concern is using file permissions of 777 to make file/folders writable which help the script to read/write/edit files.
- Click Change Permissions
777 permissions on folders/files is a website security risk. So, we would not recommend you to use 777 command over your files and folders. You can apply 755 permissions too, file's owner may read, write, and execute the file. All others may read and execute the file. Appropriate when you have programs or scripts that must be executed by non-owner users. Therefore, most scripts can work when you use 755.
- Read = 4.
- Write = 2.
- Execute = 1.
- No permissions for a user is equal to 0.
- Write/Execute without Read = 3.
- Read /Execute without Write = 5.
- Read/ Write without Execute = 6.
- Read /Write and Execute = 7.
Simply connect to FTP through FTP Client such as Filezilla, smartFTP.
1. Go to the file and right click. Choose Permissions or Attributes or Properties.
2. Apply 777 or 755 permission.
Using SSH or a script
Simply use chmod command with your directory name and press Enter.
chmod 755 configuration.php
#Above command changes the permissions of configuration.php to 755
chmod -R 755#This will modify the permissions of all files in the current folder and set them to 755.