Skip to the content

chmod 600

Only the owner can read and write, and nobody else has any access. The mode for SSH private keys and files with passwords in them.

Read (4)Write (2)Execute (1)Digit
Owner6
Group0
Others0

A program runs with the rights of the file's owner.

A program runs with the file's group. In a directory, new files get the directory's group.

In a directory, users can't delete or rename each other's files.

Owner can read and write. Group and others have no access.

chmod 600 file
chmod u=rw,g=,o= file

Common values

Share this tool:TwitterFacebookLinkedInWhatsAppEmail

What 600 allows

WhoDigitOn a fileOn a directory
Owner6 rw-read and changesee the names, nothing more
Group0 ---nothingnothing
Others0 ---nothingnothing

ls -l shows this mode as -rw------- on a file and as drw------- on a directory.

Only the owner can read the file and change it. To every other account it is closed. Root is the exception, as always: it is not held back by permissions.

Where it belongs

  • SSH private keys. ssh checks the mode before it uses a key. If the group or others can read the file, it prints "UNPROTECTED PRIVATE KEY FILE", says the permissions are too open and ignores the key. chmod 600 ~/.ssh/id_ed25519 solves that.
  • Files with passwords in them, such as .pgpass, .netrc or an .env file. PostgreSQL refuses to use a .pgpass that others can read.

600 or 400

400 also takes away the owner's own write permission, which protects against overwriting the file by accident. ssh accepts both. Since you own the file, you can give yourself write permission back whenever you need it.

Not for directories

A directory with 600 can't be entered, not even by its owner. The private mode for a directory is 700.

The chmod calculator explains how the digits are built, and what setuid, setgid and the sticky bit add to them.

See all 12