Chmod Calculator

Unix permissions as octal (755) and letters (rwxr-xr-x), with what each one allows.

Every form

Examples

Common modes

  • chmod 755 rwxr-xr-xprograms, scripts and folders
  • chmod 644 rw-r--r--ordinary files like web pages
  • chmod 600 rw-------private keys and secrets
  • chmod 700 rwx------private folders and scripts
  • chmod 777 rwxrwxrwxnothing you want to keep safe
  • chmod 775 rwxrwxr-xshared team folders
  • chmod 770 rwxrwx---folders shared with one group only
  • chmod 750 rwxr-x---programs for one group
  • chmod 744 rwxr--r--scripts only the owner runs
  • chmod 711 rwx--x--xhome folders you can pass through
  • chmod 666 rw-rw-rw-shared files, with care
  • chmod 664 rw-rw-r--files shared with a group
  • chmod 660 rw-rw----files for one group only
  • chmod 640 rw-r-----config the group needs to read
  • chmod 444 r--r--r--files nobody should change
  • chmod 400 r--------keys only the owner reads
  • chmod 4755 rwsr-xr-xprograms that run as their owner
  • chmod 2775 rwxrwsr-xshared folders where new files keep the group
  • chmod 1777 rwxrwxrwtshared temporary folders like /tmp

Questions

What does chmod 755 mean?

The owner can read, write and run the file. Everyone else can read and run it, but not change it. It is the usual mode for programs, scripts and folders.

What does chmod 644 mean?

The owner can read and change the file. Everyone else can only read it. It is the usual mode for ordinary files like web pages and config.

How do the digits work?

Each digit is one class: owner, group, others. Read is 4, write is 2 and execute is 1, added together. So 7 is 4 + 2 + 1 (all three) and 5 is 4 + 1 (read and execute).

Why is 777 a bad idea?

Anyone with an account on the machine can change or replace the file. On a web server, that often lets an attacker change your code. Use 755 for folders and programs and 644 for files.

What is the fourth digit, as in 4755?

It sets the special bits: 4 is setuid, 2 is setgid and 1 is sticky. /usr/bin/passwd is 4755, and /tmp is 1777.

What does execute mean on a folder?

It lets you enter the folder and reach the files inside. Read only lets you list the names. A folder usually needs both.