解決Host key verification failed.(親測有效)


哈嘍哇,今天在訪問遠程服務器的時候,出現了一個小問題。

原因:之前ssh聯系過服務器,重置服務器后,再次連接服務器,就會出這個問題。

一、發現問題

問題如下圖代碼:

$ ssh root@108.61.163.242
@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
@    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
SHA256:HDjXJvu0VYXWF+SKMZjSGn4FQmg/+w6eV9ljJvIXpx0.
Please contact your system administrator.
Add correct host key in /Users/wangdong/.ssh/known_hosts to get rid of this message.
Offending ECDSA key in /Users/wangdong/.ssh/known_hosts:46
ECDSA host key for 108.61.163.242 has changed and you have requested strict checking.
Host key verification failed.

這里面,有一句很關鍵。

ECDSA host key for 108.61.163.242 has changed and you have requested strict checking.
Host key verification failed.

一般這個問題,是你重置過你的服務器后。你再次想訪問會出現這個問題。

二、解決問題

解決問題也很簡單:

ssh-keygen -R 你要訪問的IP地址

例如:

ssh-keygen -R 108.61.163.242

貼個圖更直觀


免責聲明!

本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。



 
粵ICP備18138465號   © 2018-2025 CODEPRJ.COM