SSH “Server refused our key” Error (PuTTY, Ubuntu, Debian) – How to Fix
Setting up SSH key login on a fresh Ubuntu server should take two minutes – yet when I copied my public key over and connected via PuTTY, it immediately threw Server refused our key. Here is why this happens on modern Linux releases and how to fix it cleanly.
Quick answer: starting with Ubuntu 22.04 and Debian 12 (OpenSSH 8.8+), servers disable the legacy ssh-rsa signature algorithm used by older PuTTY builds. The best fix is updating PuTTY and generating an Ed25519 key; the quick workaround is re-enabling ssh-rsa in sshd_config.
Why “Server refused our key” Happens
Readers often ask whether this is a PuTTY bug or an Ubuntu bug. Neither – OpenSSH 8.8+ intentionally deprecated SHA-1 RSA signatures (ssh-rsa) for security reasons. If you connect with an older PuTTY client (below 0.75) or an old RSA key, the client offers ssh-rsa and modern OpenSSH rejects it with Server refused our key.
Fix 1 (Recommended): Switch to an Ed25519 Key & Updated PuTTY
Instead of weakening server security, switch to a modern key once and forget about it:
- Update PuTTY and PuTTYgen to the latest release from the official website.
- In PuTTYgen, select EdDSA (Ed25519) at the bottom instead of RSA and click Generate.
- Copy the single-line key from the top box (Public key for pasting into OpenSSH authorized_keys file, starting with
ssh-ed25519 AAAA...) and append it to~/.ssh/authorized_keyson the server. - Save the private
.ppkfile and attach it under Connection → SSH → Auth → Credentials in PuTTY.
Ed25519 keys are shorter, faster, and supported out of the box everywhere. If you need to migrate saved PuTTY profiles to another PC, see where PuTTY stores its settings and sessions.
Fix 2 (Quick Workaround): Re-Enable ssh-rsa in sshd_config
If you cannot upgrade the client right now (for example, legacy scripts or older hardware), add two lines to /etc/ssh/sshd_config (or cleanly in a drop-in file like /etc/ssh/sshd_config.d/99-allow-rsa.conf):
HostKeyAlgorithms +ssh-rsa PubkeyAcceptedAlgorithms +ssh-rsa
Validate the config and reload SSH without dropping your current session:
sudo sshd -t && sudo systemctl reload ssh
(On some distros the service name is sshd: sudo systemctl reload sshd.) Your older PuTTY RSA keys will be accepted again immediately.
4 Other Common Causes of “Server refused our key”
If you are already using Ed25519 and still get rejected, check these four items:
- Wrong file permissions. OpenSSH silently ignores
authorized_keysif group or world write permissions are set. Fix it on the server:chmod 700 ~/.ssh chmod 600 ~/.ssh/authorized_keys
- Wrong filename. The public key must live in
~/.ssh/authorized_keys(notid_rsa.puband notauthorized_keymissing the trailings). - Wrong key format inside authorized_keys. If you pasted PuTTYgen’s multi-line
---- BEGIN SSH2 PUBLIC KEY ----export, OpenSSH cannot parse it – it requires a single line starting withssh-ed25519 AAAA...orssh-rsa AAAA.... - Wrong username or disabled root login. Verify you are logging in as the user whose home directory holds the key (
/root/.ssh/authorized_keysforroot,/home/user/.ssh/authorized_keysfor a normal user) and thatPermitRootLogin nois not blocking root.
You can always inspect the exact server-side rejection reason in the auth log: sudo tail -n 30 /var/log/auth.log (or journalctl -u ssh -n 30). Whenever I spin up a new Linux VPS (for instance on Fornex with 7% off or Vultr), I generate an Ed25519 key right from the start so this error never shows up.
Disclosure: the Fornex and Vultr links are affiliate links – your price stays standard or discounted, and the blog earns a small commission.
