Home·File permissions
Ad

Claim your crypto exchange bonus

Bonuses you get just for signing up. Terms are copied straight from each exchange.

125 chmod permission modes

What 755 and 644 actually open up, and which umask produces them — all worked out from the three digits.

The ones you actually type

Of the 125, about ten are the ones your fingers actually reach for.

400r--------A read-only key file — even the owner cannot edit it.600rw-------Private keys and config. Only the owner reads and writes.640rw-r-----Config the team needs to read.644rw-r--r--The default for ordinary files: everyone reads, owner writes.664rw-rw-r--Files several people edit together.666rw-rw-rw-Anyone can edit it, so it is almost never used.700rwx------A folder or script only you touch.755rwxr-xr-xThe default for executables and web folders.775rwxrwxr-xA folder a team shares.777rwxrwxrwxEverything open to everyone. Used in a hurry, regretted later.

All 125

Every combination of the five values that actually get used — 0, 4, 5, 6, 7. Write-without-read and the like are left out.

Owner 0 — 0xx---

000001004005006007010011014015016017040041044045046047050051054055056057060061064065066067070071074075076077

Owner 1 — 1xx--x

100101104105106107110111114115116117140141144145146147150151154155156157160161164165166167170171174175176177

Owner 4 — 4xxr--

400401404405406407410411414415416417440441444445446447450451454455456457460461464465466467470471474475476477

Owner 5 — 5xxr-x

500501504505506507510511514515516517540541544545546547550551554555556557560561564565566567570571574575576577

Owner 6 — 6xxrw-

600601604605606607610611614615616617640641644645646647650651654655656657660661664665666667670671674675676677

Owner 7 — 7xxrwx

700701704705706707710711714715716717740741744745746747750751754755756757760761764765766767770771774775776777

How to read this

  • Read is 4, write 2, execute 1; add them for one digit. 7 is 4+2+1, 5 is 4+1.
  • The digits are owner, group, others, left to right.
  • umask is what gets taken away: from 777 for directories, from 666 for files.
  • Special bits (setuid 4000, setgid 2000, sticky 1000) add a fourth digit in front — /tmp is 1777.

Frequently asked questions

QWhat is the difference between 755 and 644?

One execute bit. 755 lets anyone run the file or step into the folder; 644 is read-only for others. Folders get 755, ordinary files 644.

QWhy not just use 777?

Because anyone who reaches the machine can then change the contents. Opening 777 to get past a permission error is taking the door off its hinges.

QWhat does umask 022 mean?

It is what gets subtracted. Directories start at 777 and become 755; files start at 666 and become 644.

QWhat is 1777, with four digits?

The leading digit is the special bits. The 1 is the sticky bit: on /tmp everyone may write, but nobody may delete another’s files.

QWhat does execute mean on a folder?

The right to go inside. With read alone you can list the names but open nothing within.