How to fix "no matching host key type found"
If you try to connect remotely to a Linux server with SSH but cannot connect and see this error:
Unable to negotiate with 192.168.1.168 port 22: no matching host key type found. Their offer: ssh-rsa,ssh-dss
This occurs because the client uses a newer SSH version with ssh-rsa and ssh-dss disabled. See the additional information. https://www.openssh.com/legacy.html To resolve it:
- Add an option to the command. For ssh-dss:
ssh -oHostKeyAlgorithms=+ssh-dss [email protected]
For ssh-rsa:
ssh -oHostKeyAlgorithms=+ssh-rsa [email protected]
- Edit ~/.ssh/config. For ssh-dss:
Host 192.168.1.168
HostName 192.168.1.168
HostKeyAlgorithms=+ssh-dss
For ssh-rsa:
Host 192.168.1.168
HostName 192.168.1.168
HostKeyAlgorithms=+ssh-rsa