How to Diagnose and Fix SSH 'Permission Denied (publickey)' Errors

The SSH error 'Permission denied (publickey)' signals that every key the client offered was rejected by the server during authentication negotiation, not a simple password mistake. Developers can diagnose the issue using 'ssh -vvv' on the client side and server logs via 'journalctl -u ssh' to identify which keys were offered and why they were refused. The four main causes are connecting as the wrong user, the public key missing from the target account's authorized_keys file, overly open file permissions causing the client to silently skip the key, and legacy ssh-rsa keys being rejected by OpenSSH 8.8 and later versions. OpenSSH 8.8, released in October 2021, disabled SHA-1-based ssh-rsa signatures by default, meaning older RSA keys from CI systems or devices like Raspberry Pis may silently fail. Regenerating keys using the ed25519 algorithm and using ssh-copy-id to install them correctly prevents most recurring authentication failures.
This is an AI-generated summary. ShortSingh links to the original source for the complete article.

Discussion (0)
Log in to join the discussion and vote.
Log in