导航

如何删除本地的known_hosts

Posted on 2025-02-08 10:16  杨彬Allen  阅读(91)  评论(0)    收藏  举报

在一次远程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 ED25519 key sent by the remote host is
SHA256:/k2B27ISt7f9rTb+3jP92dFqi51mh/0hrR6GxKVc2dM.
Please contact your system administrator.
Add correct host key in C:\\Users\\\346\235\250\345\275\254/.ssh/known_hosts to get rid of this message.
Offending ECDSA key in C:\\Users\\\346\235\250\345\275\254/.ssh/known_hosts:12
Host key for 172.30.xxx.xxx has changed and you have requested strict checking.
Host key verification failed.

 

这个时候只要手动把本地对应的172.30.xxx.xxx记录删掉,就可以继续登录了

ssh-keygen -R 172.30.xxx.xxx

# 如果还有具体的端口(比如22),那么可以用下面这个命令
ssh-keygen -R [172.30.xxx.xxx]:22