breakitdown

600 vs 644

Answer

Use 600 when a file contains anything secret (keys, passwords, tokens) and 644 when it is fine for every user on the machine to read it. Both let only the owner write.

Side by side

600644
Symbolicrw-------rw-r--r--
Owner (user)rw-rw-
Group---r--
Others---r--

chmod 600

chmod 600 = rw-------: owner read and write, everyone else nothing.

Read 4Write 2Execute 1Digit
Owner (user)6
Group0
Others0
Special0
  1. 6
    Owner (user): 6 = 4 read + 2 write
  2. 0
    Group: 0 = no permissions
  3. 0
    Others: 0 = no permissions

On a file

  • Owner (user) read it and change it
  • Group no access
  • Others no access

On a directory

  • Owner (user) list the names inside; write without x does nothing useful (names only: without x the files cannot be opened or even stat'ed)
  • Group no access
  • Others no access

chmod 600 filechmod u=rw,go= filels -l → -rw-------

chmod 644

chmod 644 = rw-r--r--: owner read and write, everyone else read.

Read 4Write 2Execute 1Digit
Owner (user)6
Group4
Others4
Special0
  1. 6
    Owner (user): 6 = 4 read + 2 write
  2. 4
    Group: 4 = 4 read
  3. 4
    Others: 4 = 4 read

On a file

  • Owner (user) read it and change it
  • Group read it
  • Others read it

On a directory

  • Owner (user) list the names inside; write without x does nothing useful (names only: without x the files cannot be opened or even stat'ed)
  • Group list the names inside (names only: without x the files cannot be opened or even stat'ed)
  • Others list the names inside (names only: without x the files cannot be opened or even stat'ed)

chmod 644 filechmod u=rw,go=r filels -l → -rw-r--r--

What to know

The difference is read access for group and others: 644 grants it, 600 removes it. On a single-user laptop that may seem academic, but on servers every service account (web server, database, CI runner) counts as "others".

Some programs enforce the difference. ssh refuses to use a private key that is 644, and ssh -i key.pem fails with "UNPROTECTED PRIVATE KEY FILE" until you run chmod 600 (or 400). Public keys and authorized_keys may be 644.

Gotchas

Related explainers

← chmod calculator