While hardening SSH on my home server I changed PasswordAuthentication no before copying my key. Instantly lost access.

What I ran:

sudo nano /etc/ssh/sshd_config
sudo systemctl restart sshd

The error:

ssh: connect to host limonlab.online port 22: Connection refused

How I fixed it: I had physical access to the laptop so I logged in directly and ran:

sudo systemctl status sshd
journalctl -u sshd -n 20

Found a syntax error in sshd_config. Fixed it, restarted, reconnected.

What I learned: Always test with sshd -t before restarting.


Leave a Reply

Your email address will not be published. Required fields are marked *