原因:目标主机发生变化(比如更换机器),导致目标主机ECDSA密钥发生更改。
解决办法:(目标主机安全的前提下)删除旧的秘钥,重新连接。
Windows
报错:
@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
@ 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:elzHhMpRAeFeF4nCLl/iSiaBOvaP7fu3q0hj2KZaK3I.
Please contact your system administrator.
Add correct host key in C:\\Users\\xiaoming/.ssh/known_hosts to get rid of this message.
Offending ECDSA key in C:\\Users\\xiaoming/.ssh/known_hosts:4
ECDSA host key for 192.168.200.18 has changed and you have requested strict checking.
Host key verification failed.
根据提示打开密钥存储文件,删除错误的ip那一行(存储路径在报错中会给出,例:C:\Users\xiaoming\.ssh\known_hosts)
文件内容:
Linux(Ubuntu18)
报错:
@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
@ 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:elzHhMpRAeFeF4nCLl/iSiaBOvaP7fu3q0hj2KZaK3I.
Please contact your system administrator.
Add correct host key in /root/.ssh/known_hosts to get rid of this message.
Offending ECDSA key in /root/.ssh/known_hosts:4
remove with:
ssh-keygen -f "/root/.ssh/known_hosts" -R "192.168.200.18"
ECDSA host key for 192.168.200.18 has changed and you have requested strict checking.
Host key verification failed.
存储文件内没有明文的ip标识,所以只能通过提示的命令删除(也许清空整个文件也可以)
ssh-keygen -f "/root/.ssh/known_hosts" -R "192.168.200.18"