新建的虚拟机,自动分配的ip为之前删除的虚拟机,在连接新创建的虚拟机时,报错如下:

[centos@svnserver ~]$ ssh -i ssh-key.ssh-key   centos@10.10.10.45
@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
@    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/centos/.ssh/known_hosts to get rid of this message.
Offending ECDSA key in /home/centos/.ssh/known_hosts:2
ECDSA host key for 【IPAddress】 has changed and you have requested strict checking.
Host key verification failed.

原因:

       因为新创建的虚拟机的ssh信息 和本地机的ssh信息对不上,因此更新本地机的ssh缓存信息即可

执行:

      ssh-keygen  -R 【IPAddress】

得到:

# Host 【IPAddress】 found: line 2
/home/centos/.ssh/known_hosts updated.
Original contents retained as /home/centos/.ssh/known_hosts.old

解决该问题

Logo

华为开发者空间,是为全球开发者打造的专属开发空间,汇聚了华为优质开发资源及工具,致力于让每一位开发者拥有一台云主机,基于华为根生态开发、创新。

更多推荐