远程时如下报错:
admin@issp:~$ ssh root@100.64.15.251
@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
@ 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:lgzULGKimjmAFFK4iH8JKZXAfq/SwJb16ppK9+OkYLY.
Please contact your system administrator.
Add correct host key in /home/admin/.ssh/known_hosts to get rid of this message.
Offending ECDSA key in /home/admin/.ssh/known_hosts:4
remove with:
ssh-keygen -f "/home/admin/.ssh/known_hosts" -R 100.64.15.251
ECDSA host key for 100.64.15.251 has changed and you have requested strict checking.
Host key verification failed.
原因应该是远程主机的认证信息修改了,本地还是保存了老的认证信息,所以需要删除,就是在进行第一次连接时选择的保存,如下所示:
admin@issp:~$ ssh root@100.64.15.251
The authenticity of host '100.64.15.251 (100.64.15.251)' can't be established.
ECDSA key fingerprint is SHA256:lgzULGKimjmAFFK4iH8JKZXAfq/SwJb16ppK9+OkYLY.
Are you sure you want to continue connecting (yes/no)? yes
Failed to add the host to the list of known hosts (/home/admin/.ssh/known_hosts).
修复方式
删除对应保存的认证信息即可,根据提示确认是第四行
root@issp:~# ssh-keygen -f "/home/admin/.ssh/known_hosts" -R 100.64.15.251
# Host 100.64.15.251 found: line 4
vim删除对应文件 “/home/admin/.ssh/known_hosts” 的第四行即可