Chmod Calculator

Tick the boxes or paste a mode to get the octal mode, the symbolic mode and the chmod command.

chmod
Permissions
Read4Write2Execute1Digit
Owner7
Group5
Others5
Special bits

chmod 755 file

What it means

  • Owner can read, write and execute.
  • Group can read and execute.
  • Others can read and execute.

Common chmod modes

ModeSymbolicUse
644rw-r--r--Regular files: the owner reads and writes, everyone else reads. The usual default for files.
755rwxr-xr-xPrograms, scripts and directories: the owner has full access, everyone else reads and executes.
600rw-------Private files: SSH private keys, ~/.ssh/config, credentials. Only the owner reads and writes.
700rwx------Private directories and scripts: ~/.ssh, a PostgreSQL data directory. Only the owner has access.
400r--------Read-only for the owner: an SSH private key, a certificate you never edit.
664rw-rw-r--Shared files: owner and group read and write, others read.
775rwxrwxr-xShared directories: owner and group have full access, others read and enter.
777rwxrwxrwxWarningEveryone can read, write and execute. Avoid it: any user can change or replace the file. Use 755 or 644 and fix the owner instead.

How chmod permissions work

Every file has three classes of user: the owner, the group and others (everyone else). Each class gets three rights: read is worth 4, write 2 and execute 1. A class's digit is the sum of its rights, so 7 is rwx, 6 is rw-, 5 is r-x and 4 is r--. The mode 755 is owner 7, group 5, others 5.

On a directory the rights mean something else: read lists the names in it, write creates, deletes and renames entries (and needs execute too), and execute lets you enter it and reach a file by name.

ls -l shows the mode as 10 characters: the file type (- for a file, d for a directory, l for a link), then the 9 permission characters, owner first. -rwxr-xr-x is a file with mode 755.

Setuid, setgid and the sticky bit

An optional first digit sets the special bits: 4 is setuid, 2 is setgid and 1 is sticky, summed like the others. ls -l shows them in the execute slots: s or S for setuid and setgid, t or T for sticky, lowercase when execute is also set.

  • 4755: a setuid program runs with its owner's privileges. /usr/bin/passwd is setuid root so it can write the password file.
  • 2775: a shared group directory; new files inherit the directory's group.
  • 1777: /tmp; anyone can create files, but only the file's owner, the directory's owner or root can delete or rename it.

Linux ignores setuid on directories and on scripts that start with a #! line.

Fix a permission denied error

If an error sent you here, these pages walk through the fix, including the mode to set:

FAQ

What does chmod 755 mean?
The owner can read, write and execute (7 = rwx); the group and everyone else can read and execute (5 = r-x). It is the usual mode for scripts, programs and directories.
What is the difference between 644 and 755?
The execute bit. 644 (rw-r--r--) suits files you only read, like config and HTML; 755 (rwxr-xr-x) suits programs, scripts and directories, which need execute to run or to be entered.
Is chmod 777 safe?
No. Any user on the system can change or replace the file. If you hit a permission error, fix the owner or group with chown or chgrp and use 755 or 644.
What do s, S, t and T mean in ls -l?
They are the special bits, shown in the execute slots: s for setuid (owner) or setgid (group), t for sticky (others). Lowercase means execute is also set; uppercase means it is not.
Why does chmod 755 not clear setgid on a directory?
GNU chmod keeps a directory's setuid and setgid bits when you give a numeric mode. Clear them with chmod g-s dir or with five digits: chmod 00755 dir.
Is what I type sent anywhere?
No. The calculator runs in your browser, so nothing you type is sent anywhere.