- Web Development Tutorials

CHMOD: File Permissions

A short explanation of the various chmod file permissions

The chmod command allows you to set certain permissions for files on your Web server. This command is commonly used to set permissions for Perl CGI scripts and the files that go with them. For instance, many scripts are set with the permissions for the owner to be able to read, write, and execute the file— while the permissions for the group and other (anybody) are set to allow them only read and execute permissions. The number that you use for this is 755, when you type the command at the telnet prompt, it looks similar to this:

Telnet/cgi-bin>chmod 755 filename.cgi

Another common permission, though it can be a security risk (anyone can write to the file), allows everyone in every grouping to read, write, and execute the file. The number for this is 777.

These numbers do mean something: The first number sets the permissions for the owner, the second sets the permissions for the group, and the last number sets the permissions for anyone else (other). Look at the chart below to see what each number means:

Number Permission(s) Set
0 (zero) No Permissions
(the user(s) cannot do anything)
1 Execute Only
(the user(s) can only execute the file)
2 Write Only
(the user(s) can only write to the file)
3 Write and Execute Permissions
4 Read Only
5 Read and Execute Permissions
6 Read and Write Permissions
7 Read, Write and Execute Permissions

So, placing 7 in all three positions means that everyone in every group can read, write and execute the file. That is how we get the number 777 for this.

As another example, if you use chmod 650, here is the breakdown:

The first number, 6, gives the owner read and write permissions.
The second number, 5, gives the group read and execute permissions.
The last number, 0, gives all others no permissions for the file.

Well, hopefully that will make file permissions a little less troublesome for you. Now you will know how to set certain file permissions without guessing at random, although that eventually works too!

If you came from the Perl script installation tutorial, you can get back to it below:
Perl Script Installation

Copyright © The Web Design Resource. All rights reserved. | Contact Us | Privacy Policy