Host key verification failed.
原创
©著作权归作者所有:来自51CTO博客作者CMMKK的原创作品,请联系作者获取转载授权,否则将追究法律责任
问题现象:
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 ECDSA key sent by the remote host is
SHA256:NHg/pDwRdtQThZzY3Z4Uwq/Rz93FgmL3UdBAFleWFWk.
Please contact your system administrator.
Add correct host key in /Users/yuanting/.ssh/known_hosts to get rid of this message.
Offending ECDSA key in /Users/yuanting/.ssh/known_hosts:102
ECDSA host key for 192.168.198.190 has changed and you have requested strict checking.
Host key verification failed.
原因:
因为服务器的ip发生变更了
第一次SSH连接时,会生成一个认证,储存在客户端(也就是用SSH连线其他电脑的那个,自己操作的那个)中的known_hosts,但是如果服务器验证过了,认证资讯当然也会更改,服务器端与客户端不同时,就会跳出错误.
解决办法:
输入命令:ssh-keygen -R +服务器的IP
ssh-keygen -R 服务器的IP