Home General questions Permissions
Permissions
One of the main advantages of Unix-based operating systems is the ability to set up the so-called permissions for every file or directory. Permissions define who is allowed to do what with the file (directory).
There is the ability to set up permissions also in the other operating systems (Windows, etc.), but this article considers mainly the work with permissions in Unix-based systems, as most hosting servers work under these operating systems.
When CS-Cart is hosted on a Unix-based server, its every single file and directory has a set of permissions associated with it.
There are three basic things that can be done to files or directories:
- You can read the file. For directories, this means listing the contents of the directory.
- You can write to (change) the file. For directories, this means creating and deleting files in the directory.
- You can execute (run) the file, if it's a program or a script. For directories, this means entering the directory and accessing files in it.
There are three types of people that can do stuff to files - the Owner of the file, anyone in the Group that the file belongs to, and Others (everyone else).
In most cases the permissions are presented as a set of three numbers (e.g. 755 or 666). The first number determines the owner permissions, the second number determines the group permissions, and the third number determines the other permissions. Each value corresponds to a certain setting of the read, write and execute permissions. Please refer to the Octal notation section of this page http://en.wikipedia.org/wiki/File_system_permissions for more details.
Most CS-Cart files should have 644 permissions, all the directories should have 755 ones.The var, images, skins and catalog directories and all its subdirectories and files should have 777 permissions. This is because CS-Cart uploads files to these directories while operating. As for the config.php file it should have 666 permissions (in the installed CS-Cart).
The permissions for CS-Cart directories and files are set when you unpack CS-Cart distributive on your server. These permissions are the same as it is set on your server for the new files. The permission behavior is affected by the "umask" functions that set default permissions for all new files/directories. Please refer to the following page for more details:
http://en.wikipedia.org/wiki/Umask
To check the permissions:
- On a Unix-based server with terminal access to it use the following command:
ls -l
This will give you permissions for all of the files and directories in the current directory. You will see something like this:
-rw-r--r-- 2008-06-11 11:06 index.php
-rw-r--r-- means that the mentioned file can be read and written by the user, but only read by the group and everyone else. - If you do not have terminal access to your server, you are able to check file access permissions using an FTP client. They are usually called File attributes.
To set up the permissions:
- On a Unix-based server with terminal access to it use the chmod command to change the permissions for a file or directory:
chmod 755 file_name
The command above sets up permissions that will allow to modify the file_name file only to the file owner, other people will be able to read or run this file.
To set up the permissions for the directory, its subdirectories and all the files under these subdirectories use the following command:
chmod -R 755 directory_name
- If you do not have terminal access to your server, change file access permissions using an FTP client. Most of them have the Change permissions or Change mode functions. Refer to your FTP client documentation for more detailed instructions on setting file permissions.
- On a WINDOWS-based server you need to set up the permissions for the files and directories for the user with the IUSER_ComputerName account.
