In this tutorial, we’ll explain how to change file permissions in cPanel. File permissions enable operating systems to understand how requests to access files should be handled.
An overview of file permissions #
There are three levels of file permission, these are read, write and execute. The Read permission allows a file to be read, the Write permission enables a file to be modified and the Execute permission allows a file to be executed.
Requests to read, write or execute can come from the user as well as other programs and files which need to access the file. This latter group includes requests sent over the internet that allow users to access a website.
To provide greater control, those requesting access are divided into three separate categories, allowing you to grant read, write and execute permissions separately for each. These categories are user, group and world. User permissions control what the file’s owner can do, Group permissions control what other files and programs in the folder can do and World permissions control the access of everyone else.
An example of file permission usage #
A web server, for example, needs to read a website’s pages so that it can display them in a user’s browser. For your website to work correctly, therefore, the following permissions will need to be set.
- Your website’s HTML files and images need to be writeable by the user and readable by others. These permissions are set automatically when the file is uploaded or installed.
- Your folders need to be executable by others. The default permissions which allow this are also automatically set. These use the value 755 which means the files are readable and executable by User, Group and World, but only writable by the User (owner).
- One set of files for which permissions are not set automatically is the CGI files (i.e. those files in the cgi-bin folder). These, too, need to be executable by others and require the same 755 value settings as in the bullet point above. However, as permissions are not set automatically, you may need to change them manually after the files have been uploaded.
Changing file permissions in cPanel #
To change file permissions in cPanel, follow these steps:
1. Log in to cPanel
2. Scroll to the Files section and click on the File Manager icon.
3. In File Manager, locate the folder or file whose permission you wish to change.
4. Next, select the file or folder you want to change by clicking its name. Once it is highlighted in blue, click the Permissions button (with the key icon) in File Manager’s top menu.
5. A dialog box will then open where you can see the existing permissions for that file or folder.
6. The three categories, User, Group and World, are displayed across the top and their Read, Write and Execute permissions are in the columns underneath. A highlighted checkbox indicates that permission has been granted.
7. To change permissions, check or uncheck the required boxes. When you do this, the permission value numbers at the bottom will automatically update.
8. Once you have made your changes, click on the Change Permissions button to save the new permission settings.
9. Do remember that if permissions are modified incorrectly, it could affect the functionality of your website.
For more information on how to use cPanel, visit our Knowledgebase.