重装系统后RSA SSH认证登录发出警告

情景再现

重装系统后RSA SSH认证登录发出警告

@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
@    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:xZGQjJHG3K2F*******2FnlR6z+fCX1z8yPJ7ayI.
Please contact your system administrator.
Add correct host key in /Users/Moby/.ssh/known_hosts to get rid of this message.
Offending ECDSA key in /Users/Moby/.ssh/known_hosts:15
ECDSA host key for 远程主机IP has changed and you have requested strict checking.
Host key verification failed.

警告信息已经非常明确,是由于远程主机的host key发生改变。而本地客户机的known_hosts文件中记录了历史的host key,验证不通过。

处理方法

  • 清除本地客户机known_hosts文件中的远程主机的旧的host key,命令如下
    $ ssh-keygen -R 远程主机的IP

  • 然后重新ssh连接
    $ ssh root@远程主机IP

  • 会需要进行一次连接确认,输入yes后,新的host key就会添加进本地客户机的known_hosts文件中。

Are you sure you want to continue connecting (yes/no)? yes
Warning: Permanently added '远程主机IP' (ECDSA) to the list of known hosts.

你可能感兴趣的:(重装系统后RSA SSH认证登录发出警告)