Skip to Content

Error: No Matching Host Key Type Found

Error: No Matching Host Key Type Found 

When trying to SSH into an older servers, you might see an error message like the one in the screenshot below.

Both server and client must support and agree upon a common set of parameters to establish a functioning connection using OpenSSH. If there is a mismatch or disagreement on these parameters, the connection attempt will fail. The above error occurs because the server and client do not support the same type of host key. This often happens when the SSH server is newer than the SSH client being used.

The client only supports “ssh-rsa,” but server does not support this.The ssh-rsa signature scheme was deprecated in OpenSSH 8.8, released on August 20, 2021.

The simplest way to fix the error is to follow the steps below

Add the options -o to the command, like below:

ssh -p port_number username@ip_address -o HostKeyAlgorithms=+ssh-rsa

Example: ssh -p 2024 [email protected] -o HostKeyAlgorithms=+ssh-rsa

If the problem is specific to one user, follow these step

Add the following line in /home/user_name/.ssh/config. Substitute "" with the IP address of the server you are trying to connect to. After attempt to SSH to the server.

root@client:~# vi /home/user_name/.ssh/config

                HostKeyAlgorithms +ssh-rsa

For a permanent fix, include the following lines in the ssh_config file.

root@client:~# nano /etc/ssh/sshd_config

             HostKeyAlgorithms +ssh-rsa

Save the file and restart sshd. After the steps ssh to the server as normal.