Utilia

Chmod Calculator

Convert Unix file permissions between checkboxes, octal (755) and symbolic (rwxr-xr-x) notation, with setuid, setgid, sticky bit and ready chmod commands.

Permissions
ClassRead (4)Write (2)Execute (1)
Owner (u)
Group (g)
Others (o)
Special bits

Commands

Numeric
Symbolic
As shown by ls -l
Relative change from {from}

Who can do what

    Common presets

    How to use the chmod calculator

    1. Start from any representation: tick the boxes in the Permissions table, type a mode in Octal (e.g. 755 or 4755), or paste a string such as rwxr-xr-x or drwxr-sr-x (straight from ls -l) in Symbolic (e.g. rwxr-xr-x). The other views follow instantly.
    2. Set the Special bits if you need them: Setuid (4000), Setgid (2000) or Sticky (1000). The octal mode then has four digits.
    3. Enter the File or directory name, tick It is a directory and Recursive (-R) as needed, and copy the Numeric or Symbolic command.
    4. To test a relative change, type it in Symbolic change (e.g. u+x,go-w) and click Apply change.

    The Common presets buttons load typical modes such as 644, 600, 755 or 2775. The Relative change from … line shows the chmod expression that turns the last preset or typed mode into the current one, for example a+x from 644 to 755.

    Reading Unix permissions

    Every file has three classes of users: the owner (u), the file’s group (g) and others (o), meaning everyone else. Each class gets three permissions, each worth a number: read = 4, write = 2, execute = 1. Adding them gives one octal digit per class: rwx = 7, rw- = 6, r-x = 5, r– = 4. That is why rwxr-xr-x is 755.

    On a directory the same letters mean something slightly different, which the Who can do what list spells out: r lets you list the entries, w lets you create, rename and delete entries (together with x), and x lets you enter the directory and reach the files inside.

    Special bits

    • Setuid (4000) on an executable makes it run with the rights of the file’s owner. passwd uses it to write the password database. It shows as s in the owner’s execute position, or S if execute is missing.
    • Setgid (2000) on an executable runs it with the group’s rights. On a directory, new files inherit the directory’s group, which keeps shared project folders consistent (2775).
    • Sticky (1000) on a directory lets only a file’s owner delete or rename it, even when everyone can write there. /tmp is 1777. It shows as t (or T) in the others’ execute position.

    Symbolic changes

    A symbolic expression is “who, operator, permissions”: u+x adds execute for the owner, go-w removes write for group and others, a=r sets read-only for all, g=u copies the owner’s rights to the group. Separate clauses with commas. The capital X adds execute only for directories or files that already have an execute bit, which makes chmod -R a+X safe on a tree of mixed files. When “who” is omitted, this tool applies the change to all classes, as GNU chmod does with a umask of 0.

    Security tips

    Avoid 777. It lets any account on the machine, including a compromised web server process, modify or replace the file. Typical safe choices are 644 for files, 755 for directories and scripts, 600 for private keys and 700 for private directories. The calculator warns about world-writable modes, 777 and setuid programs.

    Frequently asked questions

    What is the difference between chmod 755 and chmod 775?

    With 755 only the owner can write; the group and others can read and execute. 775 also gives write access to the group, which suits directories shared by a team.

    What permissions should an SSH private key have?

    600 (rw-------). OpenSSH refuses to use a private key that the group or others can read.

    Why does the octal mode sometimes have four digits?

    The first digit holds the special bits: 4 for setuid, 2 for setgid, 1 for sticky. 0755 and 755 are the same mode.

    Does chmod 644 work on a directory?

    It sets the bits, but without x nobody can enter the directory or open its files. Use 755 or 750 for directories.

    What does a capital S or T mean in ls -l?

    The special bit is set but the matching execute bit is not. It is usually a mistake: add the execute permission or remove the special bit.