chmod

What is chmod?

chmod (short for "change mode") is a Linux and UNIX command used to set the read, write, and execute permissions of a file or directory.

On Linux and other UNIX-based operating systems, who can do what to a file or directory is controlled through sets of access permissions. These permissions either permit or prevent a file from being read, modified, or - if it is a script or program such as a Perl script - executed.

How do chmod permissions work?

There are three sets of permissions: one for the owner of the file, one for the members of the file's group, and one for everyone else. Permissions can be expressed either as a nine-character string or as a three-digit number.

For a nine-character string, the characters are either a dash (-) meaning the permission is not granted, or a letter:

  • r: Read permission. The file can be opened and its content viewed.
  • w: Write permission. The file can be edited, modified, and deleted.
  • x: Execute permission. If the file is a script or program, it can be run.

For example, "rwx" means full permissions, while "---" means none have been granted.

What do the chmod numbers mean?

Each digit in a three-digit permission number ranges from 0 to 7 and represents a combination of read (4), write (2), and execute (1):
  • 0 (000): No permission.
  • 1 (001): Execute only.
  • 2 (010): Write only.
  • 4 (100): Read only.
  • 5 (101): Read and execute.
  • 6 (110): Read and write.
  • 7 (111): Read, write, and execute.

Examples of common chmod permissions

  • rw------- (600): Owner has read/write; group and others have none.
  • rw-r--r-- (644): Owner has read/write; group and others have read-only.
  • rwxr-xr-x (755): Owner has read/write/execute; group and others have read and execute.

chmod and MIDAS

The permissions rwxr-xr-x (755) are required on Perl (.pl) files in order for them to run on your web server. If you are installing a self-hosted edition of MIDAS, setting the correct chmod permissions on its Perl files is an essential step in getting your booking system running.

Related Terms


Glossary »