SSH 连接时报错:Host key verification failed.

2023-03-09 13:16:43 浏览数 (1)

完整报错信息:

代码语言:javascript复制
@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
@    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:........
Please contact your system administrator.
Add correct host key in /Users/ningli/.ssh/known_hosts to get rid of this message.
Offending ECDSA key in /Users/ningli/.ssh/known_hosts:4
Host key for x.x.x.x has changed and you have requested strict checking.
Host key verification failed.

解决办法:

参考:https://ithelp.ithome.com.tw/articles/10083004

Method 1 

代码语言:javascript复制
vim /root/.ssh/known_hosts
#把有問題的 ip  KEY刪掉

Method 2

代码语言:javascript复制
rm -rf  /root/.ssh/known_hosts
# 谨慎操作

Method 3

代码语言:javascript复制
ssh-keygen -R 2.1.2.5
# 移除有问题的即可,推荐~

0 人点赞