SSHexit code > 0

Permission denied (publickey)

$user@host: Permission denied (publickey).

Analysis

The SSH server rejected your connection because it could not authenticate your public key.

Common Triggers

  • Missing public key on the server's authorized_keys file.
  • Wrong private key used on the client.
  • Permissions on .ssh directory or files are too open.

Debug Checks

  • $Run ssh -v user@host to see which key is being offered.
  • $Check permissions: chmod 700 ~/.ssh && chmod 600 ~/.ssh/authorized_keys.

Resolution

1
Add your public key to ~/.ssh/authorized_keys on the server.
2
Specify the correct key with ssh -i /path/to/key user@host.