Web Hosting Knowledge Base | Affordable Web Hosting Plans

CHMOD Guidelines

You can make any of your files readable or un-readable by others, and writeable or un-writeable by others, by setting the file permissions correctly. Some versions of FTP software on your PC allow you to set file permissions. Moreover, when you upload some perl scripts to your cgi-bin directory, you also need to change the mode (chmod) of your scripts so that they can be executed properly.

Below are some guidelines for that.

File Permission Modes

There are 3 modes of permissions you can set for your files: read permission, write permission, and execute permission. Each permission mode represent a value.

Permission Mode Value
Read 4
Write 2
Execute 1

Actually, you can specify more than one simultaneous permission, just add the numbers together. Thus, to specify all 3 permissions use 4+2+1 = 7.

CHMOD Specification

Three digits are to be specified when referring chmod, e.g. 755

1st Digit
(e.g 7)
2nd digit
(e.g. 5)
3rd digit
(e.g.5)
The first digit (7 in this example) specifies the permissions of the owner of the file (that's you).

The 7 means that you can read, write, and execute this file.
The 2nd digit (5 in this example) specifies permissions of other people in the Unix "group" the file belongs to. Almost all MyGreatName customers are in the same Unix group.

So, the 5 means that almost all Asiamake customers can read and execute the file, but they cannot write the file.

Normally you don't allow write permission to anybody else, because you don't want someone else to change your
files.
The 3rd digit specifies the permission of everyone else.

The 5 means that everyone else in the world can read and execute your file (but not write it).

Example: CHMOD 755

The following table explain more clearly about chmod 755 :

Chmod 755
  Owner
(1st Digit)
Group
(2nd Digit)
Other
(3rd Digit)
Read
Write    
Execute
Calculation 4+2+1 4+0+1 4+0+1
Value 7 5 5

Example: CHMOD 644

Another popular permission is "chmod 644".

Chmod 644
  Owner
(1st Digit)
Group
(2nd Digit)
Other
(3rd Digit)
Read
Write    
Execute      
Calculation 4+2+0 4+0+0 4+0+0
Value 6 4 4

Chmod 644 is often used for files that are not programs or scripts, and thus cannot be executed. As you can see from the above table, it means:

Read plus write permission (4+2) for the owner. Read permission (4) for everyone else in the file's group. Read permission (4) for the rest of the world.

Example: CHMOD 700

If you don't want anyone else but ONLY you to read or execute your files, specify "chmod 700".

Chmod 700
  Owner
(1st Digit)
Group
(2nd Digit)
Other
(3rd Digit)
Read    
Write    
Execute    
Calculation 4+2+1 0+0+0 0+0+0
Value 7 0 0
web hosting knowledge base