TIL: SSH Permissions Kill Key Auth
-
1 min read
If your SSH key auth silently fails, check permissions on the remote side:
~/.sshmust be700~/.ssh/authorized_keysmust be600- Home directory must NOT be group/world writable
The server will reject your key with no useful error message. You just get Permission denied (publickey) like the key is wrong, but the key is fine. The permissions are wrong.
DreamHost defaults new authorized_keys to 664 and .ssh to 775. Both too open. OpenSSH refuses to trust keys in group-writable paths.
Fix: chmod 700 ~/.ssh && chmod 600 ~/.ssh/authorized_keys
Took an hour of fail2ban bans to figure this out.