Permissions are very important when it comes to Hosting your website. Some files need to be protected from writing and editing, as a security measure.
One of the easy and basic ways to change the permissions is through File manager in cPanel. To change the permissions for a file or folder in cpanel, please do the following:
1. Login to the cPanel.
2. Under the Files section,click on File Manager.
3. Click the name of the file or folder for which you would like to change the permissions.
4. Select the Change Permissions link from the top toolbar.
5. Select the permissions you would like to set for the file.
6. Click the Change Permissions.
What do these Permissions and Numbers mean?
File permissions determine what you are allowed to do and who is allowed to do it.
Owner | Group | World | |
Read | ✓ | ✓ | ✓ |
Write | ✓ | ||
Execute | ✓ | ✓ |
✓ |
The columns are the three types of users. First is the Owner; the owner is you, the person who has access to the cPanel. Second is the Group; the group is other people on server. Third is the World; the world is any visitor from the public (think world wide web).
Each row represents a permitted action for this file (or folder). Read means the user is allowed to view the file. Write means the user is allowed to edit the file. Execute means the user is allowed to run the file.
It is very important that Group and World be able to view your website files. However, there are some files which you may not want anyone to see. If you remove the check for Read under Group and World, then the file will not show in anyone's browser (instead visitors will see a 403 Forbidden error).
In the File Manager, permissions are expressed as numbers. We are only concerned with 3 digits, so if you see 4 digits, then ignore the first one. Thus 0755 is the same as 755.
The numbers represent a combination of each unique permission. Also, the first of the three digits represents the permissions for the Owner. The second digit represents the Group. The third digit represents the World.
- Read is equal to 4.
- Write is equal to 2.
- Execute is equal to 1.
- No permissions for a user is equal to 0.
Thus...
- Write and Execute without Read is equal to 3.
- Read and Execute without Write is equal to 5.
- Read and Write without Execute is equal to 6.
- Read and Write and Execute is equal to 7.
At this point, all you need to know is that your files should always have permissions of 644 or 755. (For most files, it doesn't matter if you give the executable permission or not. You won't see any difference.)
However, folders must always be 755.
One more rule. Any files inside the cgi-bin folder must have 755 permissions.