树莓派 SSH 连接报错“WARNING: REMOTE HOST IDENTIFICATION HAS CHANGED!”的解决

假如出现这种情况:
@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
@    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:EqIFQoWYDISyGnJggyqnk8888LeNn3tr1+QmBQaso0.
Please contact your system administrator.
Add correct host key in /Users/caolijian/.ssh/known_hosts to get rid of this message.
Offending ECDSA key in /Users/caolijian/.ssh/known_hosts:12
ECDSA host key for 192.168.1.112 has changed and you have requested strict checking.
Host key verification failed.
则是需要清理一下之前保存的认证密钥。
// 查看
ssh-keygen -l -f ~/.ssh/known_hosts
// 清理192.168.1.112的认证rsa
ssh-keygen -R 192.168.1.112

原文:https://blog.csdn.net/kxwinxp/article/details/78370913

=============================================================================

补充解决方法

-------------
解决方法 1

-------------

对于我来说,在内网的进行的一些测试,为了方便,选择最低的安全级别。在.ssh/config(或者/etc/ssh/ssh_config)中配置:

StrictHostKeyChecking no
UserKnownHostsFile /dev/null

(注:这里为了简便,将knownhostfile设为/dev/null,就不保存在known_hosts中了)

 

---------------

解决方法 2

---------------

vi ~/.ssh/known_hosts

删除对应ip的相关rsa信息

---------------

解决方法 3

---------------

rm known_hosts

From:https://www.xuebuyuan.com/602989.html

你可能感兴趣的:(树莓派)