Please contact your system administrator. Add correct host key in /Users/*********/.ssh/known_hosts

来源:互联网 发布:淘宝买家旺旺 编辑:程序博客网 时间:2024/04/30 14:56

Please contact your system administrator. Add correct host key in /Users/***/.ssh/known_hosts

macOS系统下ssh root@hostname时遇到如下问题的解决方案:

@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
The RSA host key for********.com has changed,
and the key for the corresponding IP address ****
is unknown. This could either mean that
DNS SPOOFING is happening or the IP address for the host
and its host key have changed at the same time.
@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
@ 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 the RSA host key has just been changed.
The fingerprint for the RSA key sent by the remote host is
************************.
Please contact your system administrator.
Add correct host key in /Users/***/.ssh/known_hosts to get rid of this message.
Offending key in /Users/*/.ssh/known_hosts:1
RSA host key for************** has changed and you have requested strict checking.
Host key verification failed.

方法1:使用TextMate之类的文本编辑器打开~/.ssh/known_hosts的文件,把hostname对应的行删掉(行首就是你的hostname了,注意:这里的行通常很长,编辑器可能会自动换行。找不到对应的行就全删了也没关系,怕出问题的话可以先备份一下),重新执行命令即可。

方法2:使用命令行工具(推荐iTerm)执行ssh-keygen -R hostname即可。

参考文档:

  1. Access to .ssh/known_hosts | Official Apple Support Communities
  2. ssh-keygen(1) - Linux man page
0 0
原创粉丝点击