主机认证秘钥过期
问题
在主机A通过ssh访问主机B时,无法连接,报:
@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
@ 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:**************************.
Please contact your system administrator.
Add correct host key in /home/user/.ssh/known_hosts to get rid of this message.
Offending ECDSA key in /home/user/.ssh/known_hosts:2
ECDSA host key for B has changed and you have requested strict checking.
Host key verification failed.
解决
1、影响最小的方法是将当前用户家目录下的.ssh/known_hosts文件中B主机的那一列信息删除掉,这样只需要在下次ssh
B主机的时候重新保存host key就行
2、将整个.ssh/known_hosts删除,这样需要重新保留其他主机的host key