Skip to main content

ssh and Offending key for IP in /root/.ssh/known_hosts [Resolved]

Why or why am I getting this error on server A trying to connect to server B?????

Warning: the ECDSA host key for '' differs from the key for the IP address ''
Offending key for IP in /root/.ssh/known_hosts:4
Matching host key in /root/.ssh/known_hosts:5
Are you sure you want to continue connecting (yes/no)? no
Host key verification failed.
enter code here

On server A I do this

eval `ssh-agent -s`
ssh-keyscan | tee -a /root/.ssh/known_hosts

Then I try and ssh. Wow..both servers event have the same pub and private keys. I am trying to set passwordless auth between servers.

Question Credit: Tampa
Question Reference
Asked July 20, 2019
Tags: ssh
Posted Under: Network
4 Answers

I had this exact same issue with

.ssh/known_hosts:4 .ssh/known_hosts:5

I deleted all the text out of the known_hosts file, saved, and reopened a new terminal session ssh'ing in and my issue was fixed.

credit: Rob Hitt
Answered July 20, 2019

We fixed our similar issue by removing old entries on know_hosts files.

credit: sysadmin1138
Answered July 20, 2019
Your Answer