Permissions for SSH files
| What | Path | chmod | Result |
|---|---|---|---|
| SSH folder | ~/.ssh | 700 | drwx------ |
| Public key | ~/.ssh/id_ed25519.pub | 644 | -rw-r--r-- |
| Private key | ~/.ssh/id_ed25519 | 600 | -rw------- |
| Authorized keys | ~/.ssh/authorized_keys | 600 | -rw------- |
| Config | ~/.ssh/config | 600 | -rw------- |
Home folder
Your home folder must not be writable by others, or SSH will refuse your keys. 755 (drwxr-xr-x) is the most it may be:
chmod g-w,o-w ~
The same goes for every other key you have, such as ~/.ssh/id_rsa (older RSA keys) or ~/.ssh/yubikey: private keys 600, public keys 644. Set it all at once:
chmod 700 ~/.ssh
chmod 600 ~/.ssh/*
chmod 644 ~/.ssh/*.pub