今天在SSH登录时候显示登录失败,Host key verification failed. 错误提示如下:
~ zfs$ ssh root@192.168.1.103
@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
@ 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
f7:11:42:03:40:cd:34:c3:0f:0e:80:36:22:04:de:bc.
Please contact your system administrator.
Add correct host key in /Users/zfs/.ssh/known_hosts to get rid of this message.
Offending RSA key in /Users/zfs/.ssh/known_hosts:17
RSA host key for 192.168.1.103 has changed and you have requested strict checking.
Host key verification failed.
于是立马百度了一下,说是由于公钥不一样了,所以无法登录,提示信息是 KEY 验证失败。
解决方法是:
在 /root/.ssh/known_hosts 文件里面将原来的公钥信息删除即可
SSH报"Host key verification failed."。一般来说,主要是下面的问题:
/root/.ssh/known_hosts里面记录的目标主机key值不正确。这是最普遍的情况,只要删除对应的主机记录就能恢复正常。
运行命令:
rm -rf /root/.ssh/known_hosts即可。