云服务器重装系统以后,ssh远程连接报错解决方法

出错点:

(base) *@**demac ~ % ssh ubuntu@49.*.229.21
@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
@    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:hFqsjmQ1EVzOSDmzTaTu7ysquakop/bsQoTLU6AyDMs.
Please contact your system administrator.
Add correct host key in /Users/*/.ssh/known_hosts to get rid of this message.
Offending ECDSA key in /Users/*/.ssh/known_hosts:22
Host key for 49.*.229.21 has changed and you have requested strict checking.
Host key verification failed.

 

解决方法:

删除know_hosts中的49.*.229.21这一行:

ssh-keygen -R 49.*.229.21

显示这个就代表成功了,它会自动在know_hosts.old中备份一份,不用管:

# Host 49.*.229.21 found: line 20
# Host 49.*.229.21 found: line 21
# Host 49.*.229.21 found: line 22
/Users/*/.ssh/known_hosts updated.
Original contents retained as /Users/*/.ssh/known_hosts.old

 

posted @ 2024-01-07 15:56  バカなの  阅读(63)  评论(0编辑  收藏  举报