Each file and folder located in your account has certain permissions assigned. They define who is authorized to write, read or execute this file.
Once it is created in your cPanel, default permissions are assigned. In most cases, there is no need to change them, but certain installations or updates may require a file or folder permissions change.
There are three types of access:
- read:the file can be only read
- write:the file can be edited
- execute:the file can be executed as a program
There are three types of user groups, these access types can be applied to:
- owner:the owner of the file
- group: other files which are in the same folder or group
- world:anyone else
The access level is defined in numbers:
- 0 - no access to the file
- 1 - execute only
- 2 - write only
- 3 - write and execute
- 4 - read only
- 5 - read and execute
- 6 - read and write
- 7 - read, write and execute (full permissions)
The following permissions need to be set in order for your files to be displayed properly in the browser:
- For all HTML and image files, the permissions have to be set to 644 (or 0644). They will be readable by all the user groups, but writable by the user only. These permissions are set automatically when the file is created.
- Folders the permissions have to be set to 755 (or 0755). The folders will be readable and executed by others, but writable by the user only. These permissions are set automatically when the folder is created.
- For all CGI files, the permissions have to be set to 755 (or 0755). The files will be readable and executed by others, but writable by the user only. These permissions are NOT set automatically once the file is created, you should adjust them manually.
Permissions can be very important when it comes to hosting your website. Permissions can allow our server computer to write and edit your files. Along with that, some files need to be protected from writing and editing, as a security measure. You can change your file permissions in many ways.
Using File Manager
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:
- Click File Manager
- Click the name of the file for which you would like to change the permissions.
- Select the Change Permissions link at the top right of the page.
- Select the permissions you would like to set for the file.
- Click Change Permissions
Connect to FTP. Go to the file and right click. Choose Permissions or Attributes or Properties (depends on your program).
Using SSH or a script
This can be done with chmod command.