@[TOC]解决Host Key verification failed问题,通过下面代码能解决实际问题
问题背景
在做集团CMS数据接入工作中,发现风电场站二区一体机无法SFTP进入cms服务器。
下面展示一些 日志代码
。
$ sftp cmssftp@192.168.100.100
@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
@ 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:HDjXJvu0VYXWF+SKMZjSGn4FQmg/+w6eV9ljJvIXpx0.
Please contact your system administrator.
Add correct host key in /Users/wangdong/.ssh/known_hosts to get rid of this message.
Offending ECDSA key in /Users/wangdong/.ssh/known_hosts:46
ECDSA host key for 192.168.100.100 has changed and you have requested strict checking.
Host key verification failed.
Connection closed
代码中重要的是:
ECDSA host key for 192.168.100.100 has changed and you have requested strict checking.
Host key verification failed.
一般这个问题,是运维人员重置服务器之后,无法再次访问。
解决方法
ssh-keygen -R 你要访问的IP地址
eg:
ssh-keygen -R 192.168.100.100
哈哈哈哈,解决了,给兄弟们看图片