X-Cart:How to manage file permissions on UNIX server?

From X-Cart 4 Classic
Jump to: navigation, search

If you use UNIX operation system, you should change permissions on some files in order to install X-Cart. During setup X-Cart installation wizard needs to modify config.php file, create several directories in xcart directory and populate them with files. That is why it is neccesary to set writable permissions on config.php (chmod 0666 config.php) and xcart directory (chmod 0777 . - dot means current directory, because you may install xcart in a directory with a different name, e.g. /shop or /store or in a root directory). X-Cart also uses perl scripts to connect to some payment processors and the shell script spam.sh to send newsletter; the last two commands (chmod 755 admin/spam.sh and chmod 755 payment/*.pl) make these scripts executable. You can use UNIX shell or an ftp client to run chmod commands.

If you are unfamiliar with chmod command, here is some info about it:

Chmod command is used to define the users of various groups that have certain permissions to perform an action over a file. There are three basic actions you can carry out over any file: read from it, write to it, and execute it. The basic format for chmod is chmod xyz file.foo. x, y, and z are each a number between 0 and 7. Each number represents permissions given to a group: x is for the user that owns the file, y is for the group that owns the file (normally the user's group), and z is for everybody else. To determine actual values for each number, one uses the following method: start with x = 0. If you want to be able to read from the file, add four. x can be 0 or 4 at this point in time. If you want to be able to write to the file, add two. x can now be 0, 2 (a write-only file), 4 (read-only file), or 6 (read/write file). If you want to be able to execute the program, add one. You now have a full range of possible numbers:

Digit Permissions
0 None - cannot read or write or execute
1 Can execute, but cannot read or write
2 Write-only, cannot read or execute
3 Write-able/executable
4 Read-only, cannot write to or execute
5 Read-only executable, cannot write to
6 Readable Writeable file, but not executable (ie: text file)
7 Readable Writeable Executable file - most programs are this
Note: it is insecure to keep config.php file writable for everyone. After the installation, you should change the permissions: chmod 644 config.php