全部博文(362)
分类: LINUX
2011-08-18 14:22:44
I recently switch to other VPS! Becasue of this when I ssh to new VPS (with the same domain), I got this:
01 02 03 04 05 06 07 08 09 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 | [lambasino@lambasino ~]$ ssh axcoto.com -l kureikain @@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ @ WARNING: POSSIBLE DNS SPOOFING DETECTED! @ @@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ The ECDSA host key for axcoto.com has changed, and the key for the corresponding IP address 208.111.35.209 has a different value. 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/lambasino/.ssh/known_hosts:4 @@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ @ 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 a host key has just been changed. The fingerprint for the ECDSA key sent by the remote host is fa:87:6d:54:d1:39:23:f6:78:fb:46:07:13:00:3a:1d. Please contact your system administrator. Add correct host key in /home/lambasino/.ssh/known_hosts to get rid of this message. Offending ECDSA key in /home/lambasino/.ssh/known_hosts:1 ECDSA host key for axcoto.com has changed and you have requested strict checking. Host key verification failed. [lambasino@lambasino ~]$ |
So, it turns because of the different of key in old VPS and new VPS! Of course I must remove entry for axcoto.com in my known_hosts to force ssh add host key again!
I open vim and remove that line – line which start with axcoto.com!
But I think it must have some better way or more regular way instead of hard-coding it! It turns out very easy to do it! Just use
ssh-keygen but with -R switch!
1 2 3 | [lambasino@lambasino ~]$ ssh-keygen -R axcoto.com /home/lambasino/.ssh/known_hosts updated. Original contents retained as /home/lambasino/.ssh/known_hosts.old |
Remember to remove IP too if you used IP for connecting before!