How to Fix 'No Matching Host Key Type Found' on Mac
LIKE
TWEET
SHARE
PIN
SHARE
POST
MAIL
MORE
Posted May 27, 2023 at 3:33am by iClarified
These are instructions on how to fix the 'no matching host key type found' error message when trying to SSH on Mac.
When attempting to SSH into an older server using macOS, you may receive a ssh error message that reads something like:
Unable to negotiate with 123.123.123.123 port 22: no matching host key type found. Their offer: ssh-rsa,ssh-dss
For a successful connection, OpenSSH must have at least one mutually-supported choice for each parameter. If the client and server fail to agree on a mutual set of parameters then the connection will fail. In this case, the client and server were unable to agree on the host key algorithm type. The server offered ssh-rsa or ssh-dss which are supported by OpenSSH but no longer enabled by default due to security concerns.
The ssh-rsa signature scheme has been deprecated since OpenSSH 8.8 which was released on 2021-08-20.
In the SSH protocol, the "ssh-rsa" signature scheme uses the SHA-1 hash algorithm in conjunction with the RSA public key algorithm. It is now possible to perform chosen-prefix attacks against the SHA-1 algorithm for less than USD$50K.
If you have control of the server, you should upgrade your OpenSSH version; however, if you need immediate access to the server, there are a couple ways to resolve this...
EASIEST SOLUTION
Step One
Reattempt your SSH connection, adding the following to your command line: -oHostKeyAlgorithms=+ssh-rsa