ssh连接服务器提示 Host key verification failed.

现象

image.png

u0_a258@localhost  ~  ssh root@3*.***.**.*9
@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
@    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 ED25519 key sent by the remote host is
SHA256:i************************************************0.
Please contact your system administrator.
Add correct host key in /data/data/com.termux/files/home/.ssh/known_hosts to get rid of this message.
Offending ECDSA key in /data/data/com.termux/files/home/.ssh/known_hosts:3
Host key for 3*.***.**.*9 has changed and you have requested strict checking.
Host key verification failed.

解决方案

✘ u0_a258@localhost  ~  ssh-keygen -R "3*.***.**.*9"
# Host 3*.***.**.*9 found: line 1
# Host 3*.***.**.*9 found: line 2
# Host 3*.***.**.*9 found: line 3
/data/data/com.termux/files/home/.ssh/known_hosts updated.
Original contents retained as /data/data/com.termux/files/home/.ssh/known_hosts.old
 u0_a258@localhost  ~  ssh root@3*.***.**.*9
The authenticity of host '3*.***.**.*9 (3*.***.**.*9)' can't be established.
ED25519 key fingerprint is SHA256:i************************************************0.
This key is not known by any other names.
Are you sure you want to continue connecting (yes/no/[fingerprint])? yes
Warning: Permanently added '3*.***.**.*9' (ED25519) to the list of known hosts.
root@3*.***.**.*9's password:

Welcome to Alibaba Cloud Elastic Compute Service !

Activate the web console with: systemctl enable --now cockpit.socket

Last login: Wed Dec 27 18:06:24 2023 from 4*.***.**.*2
[root@i*************Z ~]#

在客户端通过ssh-keygen -R "服务器地址" 移除原来的主机配置,即可再次连接

触发原因

  1. 可能重置了服务器(我就是这样造成的)
  2. 重新生成了SSH秘钥

参数说明

-R hostname |  [hostname]:port

Removes all keys belonging to the specified hostname (with
optional port number) from a known_hosts file.  This option is
useful to delete hashed hosts (see the -H option above).

评论 0

还没有评论,来说点什么吧。

提交后需要审核才会公开。