Unable to SSH to router

When I tried to log in to my router via SSH after several months of not doing so, I got the following error:
Unable to negotiate with port 22: no matching host key type found. Their offer: ssh-rsa
I found out after some searching that you can get around this error by using a specific option. However, after bypassing this first error, I still cannot log in because my publickey is denied. I made sure that the keys in LuCi were mine, and even added them again and restarted the router, but I still get permission denied.
I then tried enabling password logins for root, to no avail. I reset the password and tried again, nothing.
What could be causing this?

1 Like

Be sure to upgrade OpenWrt to the latest stable release as well as the SSH client.


Delete saved keys on your PC. I have seen similar problem with old ssh-server, but there was 'ssh-dss', not 'ssh-rsa'.

ssh -oHostKeyAlgorithms=+ssh-rsa root@

I found this online and it worked.

This is what was required of me to get into a switch:

ssh -o KexAlgorithms=diffie-hellman-group1-sha1 -o HostKeyAlgorithms=ssh-dss -oCiphers=aes256-cbc example@x.x.x.x

Encryption is not my thing so I don't know why this is happening.

Here's where I found the solution.

1 Like