File permissions · modechmod 600rw-------

What chmod 600 (rw-------) means, who is allowed to do what, and when these permissions are used: a private file: an SSH key, .env, a token.

Open in the calculator
Class by classfile
6
Owner
Read the contents, change and save it.
0
Group
No rights at all — no access.
0
Others
No rights at all — no access.
When and why

Nobody but the owner can even read it. For a private key that is not advice: ssh refuses a key wider than 600.

Mode
Octal600
Symbolicrw-------
ls -l line-rw-------
Command
chmod 600 file
01

What breaks

ssh refuses to use the key

Permissions 0644 for 'id_rsa' are too open.

ssh does not warn, it skips such a key: the login falls back to a password or fails outright. One command fixes it. The same logic applies to .env files and token files — except nothing warns you there, and any user on the machine can read them.

02

Easily confused with

400r--------

the same, but the owner cannot edit either: protection from your own change.

chmod 400
700rwx------

the directory counterpart: the key itself 600, the ~/.ssh directory around it 700.

chmod 700
644rw-r--r--

the public .pub key may stay readable — that is the point of it.

chmod 644
03

Commands for this case

chmod 700 ~/.ssh && chmod 600 ~/.ssh/id_rsa

the correct pair for a key: the directory first, then the key itself

chmod 600 .env

the same for a file holding passwords and tokens

Work out other permissions

The calculator opens on this mode: checkboxes, octal and symbolic notation, an ls -l line and the ready command.

Open the calculator on this modeAll common modes

Updated

«» added to favorites