File and directory permissions are complex topics. In this article, we’ll give you a basic overview of CS-Cart for administrators who need to set and check directory permissions through cPanel’s File Manager.
Understanding permissions on HostPapa servers
Permissions are used to control which users are allowed to perform specific actions on a file or directory. In Unix-based operating systems, like those installed on HostPapa servers, permissions are a combination of file ownership and permission types. Every file and directory on a server has a set of permissions that apply to it.
File and directory permissions overview
Three permission types can apply to a file or directory – read, write, and execute.
|Permission type||When applied to directories||When applied to files|
|Read (r)||Can view the names of the files in the directory||Can view the contents of the file|
|Write (w)||Can delete the directory and create, delete, and rename files in the directory||Can change and delete the file|
|Execute (x)||Can access the directory and view details (or metadata) about files in the directory||Can run executable files such as scripts and programs|
In a Unix-based operating system, there are three user types – user, group, and other.
A user can be a regular user or a system account. Regular users often interact directly with files and directories, like creating and updating files, and system users run non-interactive, background processes.
|User||The file or directory owner|
|Group||A group is a collection of users – every user belongs to at least one group. Files and directories are assigned a group.|
|Other||Everyone else – these are users other than the file or directory owner or members of the group.|
How permissions are displayed
File and directory permissions are often described using a three-digit numeric code or nine-character symbol.
In numeric notation, the first number describes the owner’s permissions, the second number describes the group’s permissions, and the third number describes the other’s permissions.
In symbolic notation, the first three characters describe the owner’s permissions, the middle three characters represent the group’s permissions, and the last three characters tell the others’ permissions. A dash indicates that no permission is granted. For example, rw-r—– describes shows that the user (first three characters) has read and write permission, users in the group (middle three characters) have only read permission, and others (last three characters) have no permission.
Here are some examples of standard permission sets:
|Numeric notation||Symbolic notation||Owner’s permissions||Group’s permissions||Others’ permissions|
How to change and check directory permissions
You can quickly check and change file and directory permissions in your cPanel File Manager.
1. Log in to your HostPapa Dashboard.
2. Click on My cPanel.
3. Click on File Manager from the Files section.
4. Make sure that File Manager is set to include hidden files by clicking on Settings in the upper right corner. Then, enable the option Show Hidden Files and click Save.
5. From the file list, choose the file or directory you want to check the permissions for, then click Permissions.
Here you can check directory permissions. They are shown in numeric notation and permission type:
This example shows a file with 644 (or rw-r–r–) permissions. The owner can read and write (rw-), the group can read (r–), and others can read (r–).
Note: In the cPanel File Manager, the other user is called ‘World.’
6. You can change permissions by selecting the proper checkboxes and ensuring the numeric notation shows the correct permissions for the file.
7. Save by clicking on Change Permissions.
CS-Cart directory permissions
After installation, most CS-Cart files have 644 permissions, and directories have 755 permissions – but var, images, and design directories, and all their subdirectories and files have 777 permissions. These allow CS-Cart to upload files and make application changes. The config.local.php file has 666 permissions.
Once the installation is completed, keep your site safe by changing the file and directory permissions to the following:
|File||Change permissions to…|
|config.local.php||644 / rw-r–r–|
|design/.htaccess||644 / rw-r–r–|
|design/index.php||644 / rw-r–r–|
|images/.htaccess||644 / rw-r–r–|
|images/index.php||644 / rw-r–r–|
|var/.htaccess||644 / rw-r–r–|
|var/index.php||644 / rw-r–r–|
|var/themes_repository/.htaccess||644 / rw-r–r–|
|var/themes_repository/index.php||644 / rw-r–r–|
If you need help with your HostPapa account, please open a support ticket from your dashboard.