Facing error WARNING: POSSIBLE DNS SPOOFING DETECTED! or WARNING: REMOTE HOST IDENTIFICATION HAS CHANGED! when you running SFTP or SSH to another server?
Let’s use www.allguru.net as an example for this issue where we want to SSH or SFTP into it and face the error as below.
WARNING: POSSIBLE DNS SPOOFING DETECTED!
The RSA host key for www.allguru.net has changed,
and the key for the according IP address 188.8.131.52
is unchanged. This could either mean that
DNS SPOOFING is happening or the IP address for the host
and its host key have changed at the same time.
Offending key for IP in /home/guru/.ssh/known_hosts:20
WARNING: REMOTE HOST IDENTIFICATION HAS CHANGED!
IT IS POSSIBLE THAT SOMEONE IS DOING SOMETHING NASTY!
Someone could be eavesdropping on you right now (man-in-the-middle attack)!
It is also possible that the RSA host key has just been changed.
The fingerprint for the RSA key sent by the remote host is
Please contact your system administrator.
Add correct host key in /home/guru/.ssh/known_hosts to get rid of this message.
Offending key in /home/guru/.ssh/known_hosts:12
RSA host key for www.allguru.net has changed and you have requested strict checking.
Host key verification failed.
One of the solution is to remove all keys belonging to hostname from a known_hosts file. As you can see, the error message did mention the file is in /home/guru/.ssh/known_host.
$ ssh-keygen -R server.example.com
Original contents retained as /home/guru/.ssh/known_hosts.old
The alternative solution is to delete the known_hosts file if you have only one ssh server registered in known_hosts.
$ cd /home/guru/.ssh/
$ rm known_hosts
$ ssh www.allguru.net
You should be able to SSH and SFTP to the server after applying one of the solution with the acceptance RSA fingerprinting prompt.
Next» Remove ^M Character From Unix File Using VI