The permissions SSH demands on your .ssh directory
June 13, 2026
The problem. SSH is strict about file permissions, on purpose. If your .ssh directory or your private keys are readable by anyone but you, ssh and scp quietly refuse to use them. This bites hardest right after you restore a .ssh directory from a backup, because the restored copy almost never lands with the exact modes SSH insists on.
The fix.
SSH wants three things: the .ssh directory reachable only by you, the private keys readable only by you, and the public keys readable by anyone. A short script run inside each account's home directory sets all of it. I keep it as permissions.bash:
#!/bin.bash
chmod 700 ~/.ssh
chmod 600 ~/.ssh/*
chmod 644 ~/.ssh/*.pub
700 on .ssh means only you can enter the directory. 600 on everything inside makes every key private to you, which is exactly what SSH checks before it will use a key. The final 644 on the .pub files relaxes the public keys back to world readable, which is fine, since a public key is meant to be shared. Run it once per account after restoring the keys, and ssh and scp are happy again.