I am trying to use the command:

ssh -i id_rsa root@<ip>

This gave me the error as:

Unable to negotiate with port 22: no matching host key type found. Their offer: ssh-rsa,ssh-dss

Also after googling a bit, I tried:

ssh -oHostKeyAlgorithms=+ssh-dss -i id_rsa root@<ip>

And, this command is prompting for a password when I am using id_rsa for authentication.

How should I use OpenSSH private key to authenticate in SSH?

I am using Kali linux, 16.0-kali6-amd64, (2022-03-23) x86_64 GNU/Linux

In the verbose output, it shows that no such directory for 'load_hostkeys'. Then DSA host key found

Get agent_identities: agent contain no identities, Will attempt some key (explicitly)

send_pubkey_test: no mutual signature algorithm

after that it goes to try for authentication with password, and gives a prompt

  • OpenSSH since 7.0 doesn't accept hostkey ssh-dss and you must add it, similarly since 8.8 it doesn't use client ssh-rsa and you must add that with -oPubkeyAcceptedAlgorithms=+ssh-rsa. (It will still use client RSA key with the newer rsa-sha2 algorithms, but your server is obviously old and doesn't support those.) See unix.stackexchange.com/questions/410468/… and cross serverfault.com/questions/1092998/… . Apr 16 at 1:45
  • What's running on the server side? It's clearly out of date and doesn't support any modern algorithms.
    – bk2204
    Apr 16 at 11:47
  • @dave_thompson_085, Thanks for the great answer, I think this should help. Apr 17 at 3:26
  • @bk2204, yes the server side ssh is older than what I have in machine. Apr 17 at 3:26
  • @dave_thompson_085, Thank you, this solved the problem. Apr 17 at 12:07

1 Answer 1


As mentioned by @dave_thompson, you can use additional argument when using ssh:

ssh -v -oHostKeyAlgorithms=+ssh-rsa username@ipaddress

or another alternative, if you often access server via ssh, you can create a file named config in folder .ssh, and then add this key inside config file:

Host [ipaddress]

This config file has same result as first way.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.