Chmod Calculator

Tick the permissions you want, or type an octal mode like 755 / 4755, symbolic text like rwxr-xr-x, a line from ls -l or a chmod expression like u+x,go-w. Everything stays in sync and you get ready-to-paste chmod commands.

Permissions

Read Write Execute Octal
$
$
ls -l

    Common permissions

    Click to load

    umask calculator

    Default permissions for new files and directories

    Run umask in a shell to see yours. Common values: 022 (most Linux distros), 002 (shared-group setups), 077 (private).

    New files
    New directories

    How Linux file permissions work

    Every file and directory on Linux, macOS and other Unix-like systems has an owner, a group, and three sets of permissions: one for the owner (user, u), one for members of the file's group (g), and one for everyone else, the others (o). Each set has three switches:

    The kernel checks only one set: if you own the file, the owner bits apply; otherwise if you are in its group, the group bits apply; otherwise the others bits. So chmod 707 really does lock group members out even though "everyone" has access.

    Octal notation: the maths behind 755

    Each permission has a value: read = 4, write = 2, execute = 1. Add the values you want to get one digit from 0 to 7 per set, then write the three digits in owner, group, others order.

      owner     group     others
      r w x     r - x     r - x
      4+2+1     4+0+1     4+0+1
        7         5         5      →  chmod 755

    So 6 is read + write, 5 is read + execute, 4 is read only and 0 is nothing. In ls -l output the same thing is written as ten characters, for example -rwxr-xr-x: the first character is the type (- file, d directory, l symlink) and the next nine are the three sets.

    Special bits: setuid, setgid and sticky

    An optional fourth digit goes in front of the other three and is built the same way: setuid = 4, setgid = 2, sticky = 1.

    Note that GNU chmod does not clear setuid/setgid on directories when you give a 3-digit mode, so chmod 755 dir leaves an existing setgid bit in place. Use chmod g-s dir or a 5-digit mode such as chmod 00755 dir to remove it.

    Symbolic mode: u, g, o, a with +, - and =

    Instead of a number you can describe a change: who (u, g, o or a for all), an operator (+ add, - remove, = set exactly) and the permissions. Clauses are separated by commas. chmod u+x script.sh makes a script executable for you without touching anything else, chmod go-w file removes write access for group and others, and chmod u=rwx,g=rx,o= dir is the same as chmod 750 dir. Symbolic changes are relative, which is handy when you don't know or care about the current mode. (If you leave out the "who" part, real chmod applies the change to all three sets but respects your umask; this calculator treats it as a.)

    What is umask?

    The umask is a mask of permissions that are removed from newly created files and directories. Programs usually create files with 666 (no execute) and directories with 777, and the kernel clears every bit that is set in the umask. With the common umask 022, new files become 644 and new directories 755: write access is taken away from group and others. A umask of 077 makes everything private (600 / 700). It is a bitwise mask, not subtraction, so umask 033 gives files 644, not 633.

    Common mistakes