What is chmod?

In Linux, and other UNIX based operating system, who can do what to a file or directory is controlled through sets of access permissions and the special mode flags of file system objects.

Collectively these were originally called its modes, and the name "chmod" was chosen as an abbreviation of "change mode".

There are three sets of permissions. One set for the owner of the file, another set for the members of the file's group, and a final set for everyone else.

The permissions control the actions that can be performed on the file or directory. They either permit, or prevent, a file from being read, modified or, if it is a script or program (such as a Perl script), executed.

For a directory, the permissions govern who can move into the directory and who can create, or modify files within the directory.

Permissions may be indicated by either a nine character string, or a three digit number.

For a 9 character permission string:

The characters are indicators for the presence or absence of one of the permissions. They are either a dash (-) or a letter. If the character is a dash, it means that permission is not granted. If the character is an r, w, or an x, that permission has been granted.

The letters represent:

For example, a permission string of "---" indicates that no permissions have been granted. A permissions string of "rwx" means full permissions have been granted, as the read (r), write (w), and execute (x) flags are all present.

For a 3 digit number:

Each digit can be in the range 0 - 7, and is a decimal representation of a binary number.

Examples of common chmod file permissions:

These last permissions, rwxr-xr-x (755), are required to be set on Perl (.pl) files in order for them to run (be executable) on your web server.

Related Terms

← Back to Glossary