File Permissions/Modes

Article Details
URL: https://support.quadrahosting.com/index.php?_m=knowledgebase&_a=viewarticle&kbarticleid=154
Article ID: 154
Created On: 03 Mar 2008 07:40 AM

Answer

About File Modes

File Mode defines the sets of permissions that are applicable to the file/directory. It defines who can read, write and execute it. File mode for cgi-bin has always been traditionally set to 755 (read + write + execute for owner, and read + execute for group and others). Since we utilize suExec, the CGI scripts can be safely set to 711 or even 700. This means nobody else can read your scripts. This provides a very good security in the shared hosting environment.

The file mode can be changed by using an FTP client, through the shell or using WebShell (the web based file manager, available through your control panel). It is normally changeable using the "chmod" command.

 

What do these numbers mean?

The file mode consists of three digits, and each digits range from 0 to 7. It defines who can access the file. There are three groups of people, each is defined by a digit in the file mode.

The first digit defines the permissions for the owner of the file

The second digit defines the permissions for the people in the same group as the file's group.

The third digit defines the permissions for others.

The permissions are:

Read, Write, Execute (often shortened to rwx).

A digit represents the three access rights.

0 = No rights

Basic:

1 = Execute Only

2 = Write Only (rarely used)

4 = Read Only

Combination of the Basic:

3 = Write and Execute (rarely used)

5 = Read and Execute

6 = Read and Write

7 = Read, Write and Execute

As you can see, 3 = 2 + 1, which means Write and Execute. The same applies for the other combinations.

So when you see the file mode of 755, it means:

The first digit is 7 = read, write and execute = file owner can read, write and execute this file

The second digit is 5 = read and execute = people in the same group as the file's group can read and execute this file

The third digit is 5 = read and execute = everyone else can read and execute this file too