The format of the command is:

chmod {options} mode file(s)

{options} is optional; the only common option is -R to make the command recursive (descend into specified directory and its subdirectories and apply permissions change to all files found)

mode is either a numeric or symbolic permission mode.

A numeric permission mode consists of up to four octal digits, which are interpreted as twelve individual bits; any missing digits are treated as leading zeroes. (Most commonly, the first digit is omitted.)

The first digit contains the setuid bit (4000), setgid bit (2000), and the sticky bit (1000). The other three digits correspond to user (i.e., owner of the file), group (the group that owns the file), and other (everybody else) permissions; each one contains a read bit (4), write bit (2), and execute bit (1).

A symbolic permission mode consists of three substrings concatenated. The first substring controls who to set permissions for: u, g, or o for user, group, or other, respectively, or some combination of these, or a for all, or nothing for an implicit all which ignores bits set in the user's umask.

The second substring is the operation to perform: + to add permissions, - to remove them, or = to set the specified permissions and remove all others for the specified who.

The third substring tells what permissions to set; there are several possibilities, which may be concatenated, though not all combinations make sense:

  • r, w, x correspond to the read, write, and execute bits respectively
  • s is the setuid/setgid bit for user and group, and meaningless for other
  • t is the sticky bit for other and meaningless for user and group
  • X means apply execute permission only for directories and files for which some user already has execute permission
  • u, g, o correspond to the permissions user, group, and others currently have