ubuntu下ssh访问主机失败提示:WARNING REMOTE HOST IDENTIFICATION HAS CHANGED

在ubuntu下使用ssh访问其他主机时或者虚拟机时,提示如下:

@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
@    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 RSA key sent by the remote host is
SHA256:YV7LxZ1VwzMqMfXG2sEiDtKBhYvRx2olPa3RrAuNM74.
Please contact your system administrator.
Add correct host key in /home/master/.ssh/known_hosts to get rid of this message.
Offending RSA key in /home/master/.ssh/known_hosts:10
  remove with:
  ssh-keygen -f "/home/master/.ssh/known_hosts" -R "192.168.122.51"
RSA host key for 192.168.122.51 has changed and you have requested strict checking.
Host key verification failed.

ubuntu下ssh访问主机失败提示:WARNING REMOTE HOST IDENTIFICATION HAS CHANGED_第1张图片

原因分析:之前ssh连接过同一个ip的 其他虚拟机,连接当前虚拟机的秘钥和之前已存的比匹配,需要从已知的host中删除即可。

解决方法:

 方法1:错误提示中其实已经给出了。

使用ssh-keygen –R hostname/hostIP

ssh-keygen -R 192.168.122.76

方法2:

使用编辑~/.ssh/known_hosts文件,删除访问主机key对应的一行。(可以直接删除整个文件内容,如果担心删错可以先备份,在删除)

gedit ~/.ssh/known_hosts
vi ~/.ssh/known_hosts

注:一般用第一种方法,即直接又简单。

你可能感兴趣的:(Linux,#,system,ssh访问出错,WARNING,REMOTE,HOST,IDENTIFICATION)