一、主要现象
ssh/scp 失败,host key verification failed
AC-2:~ AC$ ssh root@47.105.146.74
@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
@ 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:XdI1QgvktDjh1Fr6D5ohtuz6I3y+stC8VASQqA7MGr8.
Please contact your system administrator.
Add correct host key in /Users/AC/.ssh/known_hosts to get rid of this message.
Offending ECDSA key in /Users/AC/.ssh/known_hosts:21
ECDSA host key for 47.105.146.74 has changed and you have requested strict checking.
Host key verification failed.
AC-2:~ AC$
从报错信息看是因为目标主机key【比如重做系统或者还原】与已保存的key不同导致认证失败。
二、解决
删除留存的秘钥
rm -rf /Users/AC/.ssh/known_hosts
网友评论