Permissions

Created: Nov 15, 2007

There have been a lot of questions and confusion about how to set the permissions in LinkEX.

Why permissions

In *nix (linux, freebsd and other unix like operating systems), there is much more focus on rights than eg. in a windows environment. This is because *nix OS'es are developed with much more focus on multiple users using the same system. To keep a system stable while allowing multiple users, require a lot more restriction on who can do what to the system.

Each user on the system is granted with a username. A unique identifier on the system.

Each user can be in one or more groups. Groups in *nix systems are there to help maintain and organize users.

To restrict access to ones files, you can grant file and directories with a set of permissions.

Permission classes

A permission is divided into three different classes, known as user, group, and others.

When you set the permission on a folder or a file, you properly use a command like CHMOD. CHMOD requires an argument of either an octal number, or a written set of permissions.

The octal number (eg. 777 or 755 ) represents the three classes, where the number is a bit-pattern which consists of execute (1), write (2) and read (4).

This may sound pretty confusing, but lets put it in a table

             | Owner | Group | Other |                       | Owner | Group | Other |
-------------+-------+-------+-------+          -------------+-------+-------+-------+
Read    (4)  | x (4) | x (4) | x (4) |          Read    (4)  | x (4) | x (4) | x (4) |
Write   (2)  | x (2) | x (2) | x (2) |          Write   (2)  | x (2) | - (0) | - (0) |
Execute (1)  | x (1) | x (1) | x (1) |          Execute (1)  | x (1) | x (1) | x (1) |
-------------+-------+-------+-------+          -------------+-------+-------+-------+
                  7       7       7                               7       5       5

Now if you want onle the owner of the file to be able to read it, and nothing else, it would require a permission of 400 thats it. Noone else would be able to read or write to it.

How is this controlled?

The operation system will make sure the permissions are followed. When you execute a program or logs in on SSH (your're actually executing a program called a shell, could be bash or tcsh), the process running the program is owned by you. When you try to open a directory or a file, the OS will make sure you have the permission to read it.

Permissions and LinkEX

When you run LinkEX it is executed through a program called, the webserver. On some servers the webserver is runed by a user called eg. "www", which is a designated user, just for running the webserver.