Private key
- Input
- 600
- Expected output
- rw-------
Only the owner reads and writes.
ssh key permissions chmod 600
The 600 and 700 shortcuts of the calculator carry the explanation of each mode. This page gathers the full SSH table and the commands that repair an install with messy permissions.
Only the owner reads and writes.
Read only, for the owner only.
Only the owner can enter.
Not a secret, anyone may read it.
This is what triggers the Permissions 0644 are too open warning.
The 7 gives the owner read, write and execute (4+2+1). Each 5 gives group and others read and execute (4+1), without write. On files it is the mode of programs and scripts; on directories it lets everyone list and enter, but only the owner create and delete items. ls -l shows rwxr-xr-x.
Both work, because ssh only requires that other users have no access. 600 lets you rewrite the key (when changing its passphrase, for example); 400 protects against accidental writes.
Look at the server: the home and ~/.ssh must not be writable by group or others (StrictModes), and authorized_keys must belong to the user. Run ssh -v on the client and read the server authentication log, which explains the refusal.
The Windows OpenSSH client uses NTFS ACLs, not chmod. On WSL, keep the key inside the Linux filesystem (the WSL home), where chmod works, and not under /mnt/c.
Accepts rwxr-xr-x, -rwxr-xr-x or clauses such as u=rwx,g=rx,o=.
644: regular file. The owner reads and writes, everyone else only reads.
chmod 644 arquivochmod u=rw,g=r,o=r arquivochmod -R 644 pasta/find . -type f -exec chmod 644 {} +find . -type d -exec chmod 644 {} +install -m 644 origem destinomode: '0644'RUN chmod 644 /caminho/arquivoCOPY --chmod=644 origem destinogit update-index --chmod=-x arquivoFollows POSIX and GNU chmod (tested on coreutils 9.4). BSD, macOS, ACLs and mounts such as FAT or NTFS may behave differently.