SSH warning: “POSSIBLE DNS SPOOFING DETECTED!”
I got an warning from SSH when i logged onto my vps.
myvps@Desktop:~$ ssh-copy-id -i .ssh/id_rsa.pub myvps@Laptop
/usr/bin/ssh-copy-id: INFO: Source of key(s) to be installed: ".ssh/id_rsa.pub"
/usr/bin/ssh-copy-id: INFO: attempting to log in with the new key(s), to filter out any that are already installed
/usr/bin/ssh-copy-id: ERROR: @@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
ERROR: @ WARNING: POSSIBLE DNS SPOOFING DETECTED! @
ERROR: @@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
ERROR: The ECDSA host key for laptop has changed,
ERROR: and the key for the corresponding IP address 192.168.0.103
ERROR: is unknown. This could either mean that
ERROR: DNS SPOOFING is happening or the IP address for the host
ERROR: and its host key have changed at the same time.
ERROR: @@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
ERROR: @ WARNING: REMOTE HOST IDENTIFICATION HAS CHANGED! @
ERROR: @@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
ERROR: IT IS POSSIBLE THAT SOMEONE IS DOING SOMETHING NASTY!
ERROR: Someone could be eavesdropping on you right now (man-in-the-middle attack)!
ERROR: It is also possible that a host key has just been changed.
ERROR: The fingerprint for the ECDSA key sent by the remote host is
ERROR: SHA256:1n48LRTTlQUqoNlSZmT99m/suucIGj1VsD7NF6hw5RQ.
ERROR: Please contact your system administrator.
ERROR: Add correct host key in /home/myvps/.ssh/known_hosts to get rid of this message.
ERROR: Offending ECDSA key in /home/myvps/.ssh/known_hosts:3
ERROR: remove with:
ERROR: ssh-keygen -f "/home/myvps/.ssh/known_hosts" -R "app1"
ERROR: ECDSA host key for laptop has changed and you have requested strict checking.
ERROR: Host key verification failed.
The solution comes from the above error log:
This is often because a serverhas reinstalled the system,
After reinstallation, the LAN IP in the cluster is redistributed, and the /etc/hosts of each node is not completely modified and synchronized.
ssh-keygen -f "/home/myvps/.ssh/known_hosts" -R "app1"
Then :
ssh-copy-id -i .ssh/id_rsa.pub myvps@Laptop
Problem solved. Hope this can help you!