ssh無法登錄linux服務器的解決辦法


最近之前使用的一台linux服務器被長官重裝系統了,導致ssh登錄的時候出現如下錯誤:

@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
@ 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 RSA key sent by the remote host is
SHA256:az7FfVtBpsebsnnIN5nAyqBzE3oEmTYcTd/bJu+yp38.
Please contact your system administrator.
Add correct host key in /home/kaixi_fan/.ssh/known_hosts to get rid of this message.
Offending RSA key in /home/kaixi_fan/.ssh/known_hosts:2
RSA host key for 172.29.38.37 has changed and you have requested strict checking.
Host key verification failed.

看起來是ssh key我本地終端和服務器保存的,2者對不上了,這時候可以這么辦:
刪除提示信息中,對應的行數,例如上例,需要刪除 /home/kaixi_fan/.ssh/known_hosts文件的第2行。

然后重新登錄,會給出如下提示:

The authenticity of host '172.29.38.37 (172.29.38.37)' can't be established.
ECDSA key fingerprint is xxxxxxxxxxxxxxxxxxxxxxxxxx(此處是key)
Are you sure you want to continue connecting (yes/no)? yes(輸入yes)
Warning: Permanently added '172.29.38.37' (ECDSA) to the list of known hosts.

 

重新輸入yes就好啦。


注意!

本站转载的文章为个人学习借鉴使用,本站对版权不负任何法律责任。如果侵犯了您的隐私权益,请联系我们删除。



 
粤ICP备14056181号  © 2014-2020 ITdaan.com