1.问题:
已经设置了ssh无密码登录,可在使用过程中,可能会出现如下问题:
tyltrinobugdeMacBook-Pro:~ tyltr$ ssh -p 26722 root@104.153.101.34
@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
@ 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:3dDIlwt1L3ACU88IqAjPCh0hFMpmiAg+3/qmdKBkVO0.
Please contact your system administrator.
Add correct host key in /Users/tyltr/.ssh/known_hosts to get rid of this message.
Offending ECDSA key in /Users/tyltr/.ssh/known_hosts:4
ECDSA host key for [104.153.101.34]:26722 has changed and you have requested strict checking.
Host key verification failed
2. 解决方案
注意上述问题中,红字的部分。表明 [104.153.101.34]:26722 的ECDSA host key 出现问题,那么就重新去掉这个有问题的 key就行了。
注意:部分小伙伴的错误提醒中,并没有红字这句话,或者没有直接提示出时哪一个ip的ECDSA host key 出现问题,那怎么办?
好办!
直接查看 .ssh/known_hosts 文件
tyltrinobugdeMacBook-Pro:~ tyltr$ cat /Users/tyltr/.ssh/known_hosts | grep 104.153.101.34
[104.153.101.34]:26722 ecdsa-sha2-nistp256 AAAAE2VjZHNhLXNoYTItbmlzdHAyNTYAAAAIbmlzdHAyNTYAAABBBEa6LASIRwK5dournV59XKYjAQzn9Q1xqyEawg/So7YlW5kQ3MBJJXQfEqstD1x87yNcMDSttQI4PVUirzuSwLQ=
使用命令: ssh-keygen -R [104.153.101.34]:26722