I have an issue while trying to use the SSH command on my Kali Linux system (version 16.0-kali6-amd64, 2022-03-23). I'm attempting to authenticate using an OpenSSH private key.
I started by using the following command:
ssh -i id_rsa root@<ip>
However, this resulted in the following error:
Unable to negotiate with port 22: no matching host key type found. Their offer: ssh-rsa, ssh-dss
After some research, I tried the following command to address the issue:
ssh -oHostKeyAlgorithms=+ssh-dss -i id_rsa root@<ip>
But with this command, it prompted me for a password even though I intended to use the id_rsa key for authentication.
In the verbose output, I noticed the following messages:
- "No such directory for 'load_hostkeys'"
- "DSA host key found"
- "Get agent_identities: agent contains no identities, will attempt some key (explicitly)"
- "send_pubkey_test: no mutual signature algorithm"
The authentication process then attempted to use a password and provided a prompt.
I need assistance with using my OpenSSH private key for SSH authentication.
-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/… .