我們經常遇到ssh 某臺linux機器的時候出現如下提示:
@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ @ 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 2a:b5:41:83:18:92:d1:2c:fb:1e:05:f5:04:c4:c7:e0. Please contact your system administrator. Add correct host key in /root/.ssh/known_hosts to get rid of this message. Offending key in /root/.ssh/known_hosts:1433 Password authentication is disabled to avoid man-in-the-middle attacks. Keyboard-interactive authentication is disabled to avoid man-in-the-middle attacks.
出現這個現象的原因是,本地機器曾經登陸過此機器,在本機的/root/.ssh/known_hosts 文件記錄這個機器的指紋信息;當機器被重裝或者種種修改,導致指紋改變!再次從本機登陸此機器,就會提示,機器指紋改變。如何消除這個現象呢?我們可以刪除本機記錄的舊指紋。
ssh-keygen -R remoute_hostname # 或者 ssh-keygen -R remoute_ip
然後再次ssh登陸就會保存新指紋。注:經第一次提示保存!保存好後,下次再登陸不會有提醒了