Chapter 9 · 9.2
Common SSH error messages
| Message | What does it mean? | What do you do? |
|---|---|---|
Connection timed out | Your computer gets no response. The VPS is switched off, the IP address is wrong, or a firewall is blocking port 22. | Check that the VPS is running and the IP address is correct. Log in via the console and check your firewall (Locked out: you can no longer reach your server). |
Connection refused | The server responds, but nothing is listening on that port. SSH isn't running or is listening on a different port. | In the console: systemctl status ssh and ss -tlnp | grep ssh. |
Permission denied (publickey) | The server only accepts keys and your key doesn't match. | Check the username, whether you're using the right key (ssh -v shows which one it tries) and the permissions of ~/.ssh on the server (Putting your key on the server and testing it). |
Permission denied (publickey,password) | The password or key is wrong. | Watch out for capital letters. If necessary, set a new root password in the VPS screen. |
REMOTE HOST IDENTIFICATION HAS CHANGED | The server shows a different fingerprint from the one your computer remembers. | This is normal after a reinstall. In that case: ssh-keygen -R 203.0.113.10 and log in again, using the check from Logging in with SSH for the first time. If you haven't changed anything, don't continue: find out why first. |
Too many authentication failures | Your computer tries too many keys in a row. | Specify the key with -i ~/.ssh/id_ed25519 or add IdentitiesOnly yes to your SSH config (An SSH config: log in with a short name). |
UNPROTECTED PRIVATE KEY FILE! | Your private key can be read by others on your own computer. | On Mac and Linux: chmod 600 ~/.ssh/id_ed25519. On Windows: make sure only your account can read the file. |
See more
With ssh -v anna@203.0.113.10 you can see step by step what happens: which keys your computer tries and where it goes wrong. On the server you can see the other side with sudo journalctl -u ssh -e (on AlmaLinux and Rocky Linux -u sshd).
