File permissions

All files on servers have access permissions. They show to the operating system how to deal with requests to access such files. There are three types of access:

  • Read - Files with read access can be only read by the user.
  • Write - Files with write access can be edited by the user.
  • Execute - Files with execute access can be executed as programs by the user.

These types of access are applied for three types of user groups:

  • User - The owner of the file. 
  • Group - Other files which are in the same folder or group. 
  • World - Anyone else.

In order for your files to be displayed properly in a browser the following permissions need to be set:

- For all HTML files and images the permissions have to be set to 644. Thus they will be readable by User, Group, and World + writable by User. These permissions are set automatically when files are uploaded.

- For all folders the permissions have to be set to 755. Thus they will be executable by others: readable by User, Group, and World, writable by User, executable by User, Group, and World. These permissions are set automatically when you create a folder.

- For all CGI files (all files in the cgi-bin folder) the permissions have to be set to 755. Thus they will be executable by others: readable by User, Group, and World, writable by User, executable by User, Group, and World. These permissions are not set automatically when you upload files. You need to change file permissions manually.

It is important that none of your files or folders is writable by anyone else. Any file or folder which is writable by others can be erased by them. Generally there is no problem, just be careful how you set your permissions.

How to change file or folder permissions
 
1) Login to your cPanel 
2) Go to File Manager under Files menu 
3) Go to the file or folder that you need to change 
4) Choose the name of the file or folder you need to change the permissions for 
5) Click on the Change Permissions link at the top of the File Manager page 
6) Choose right file/folder permissions by clicking on tick boxes. The permission values underneath the tick boxes are updated automatically. 
7) Click on Change button when the needed permissions are chosen. The new permissions have now been saved.

Was this answer helpful?

Related Articles

Error: You do not have permission to access

Every file and directory on Linux system is owned by a specific user and group and has...