OpenSSH的known_hosts引发的问题

来源:互联网 发布:唐青枫官方捏脸数据 编辑:程序博客网 时间:2024/06/07 01:12

Ubuntu 15.4

http://blog.csdn.net/u013686019/article/details/54574119

在使用OpenSSH的时候,如果没有特别指定目录,known_hosts文件存在于:

~/.ssh/

目录下。known_hosts记录了本机访问过的计算机的pubic key。


这两天从服务器同步Android源码,执行repo sync后总是卡在连接服务器的位置:

Get ssh://git@www.xxxxxx.com.cn/gerrit/android/platform/manifestWarning: the ECDSA host key for 'www.xxxxxx.com.cn' differs from the key for the IP address '192.168.1.9'Offending key for IP in /home/gerrit/.ssh/known_hosts:1Matching host key in /home/gerrit/.ssh/known_hosts:3Are you sure you want to continue connecting (yes/no)? yesWarning: the ECDSA host key for 'www.xxxxxx.com.cn' differs from the key for the IP address '192.168.1.9'Offending key for IP in /home/gerrit/.ssh/known_hosts:1Matching host key in /home/gerrit/.ssh/known_hosts:3Are you sure you want to continue connecting (yes/no)? yes

怎么办呢?那就调试找原因。在一台没有访问过Android源码服务器的机器上执行同步,完全没问题;看到上述终端输出提到known_hosts文件,就查找了下该文件的相关信息。接着就是测试,为方便故,直接把~/.ssh/known_hosts文件删除了,这是终端输出如下:

Get ssh://git@www.xxxxxx.com.cn/gerrit/android/platform/manifestThe authenticity of host 'www.xxxxxx.com.cn (192.168.1.9)' can't be established.ECDSA key fingerprint is 4e:a5:bc:9c:92:94:29:e4:4a:12:94:fe:54:b2:4e:b0.Are you sure you want to continue connecting (yes/no)? The authenticity of host 'www.xxxxxx.com.cn (192.168.1.9)' can't be established.ECDSA key fingerprint is 4e:a5:bc:9c:92:94:29:e4:4a:12:94:fe:54:b2:4e:b0.Are you sure you want to continue connecting (yes/no)? yesWarning: Permanently added 'www.xxxxxx.com.cn,192.168.1.9' (ECDSA) to the list of known hosts.

看内容这是要重新生成~/.ssh/known_hosts。

终止操作,重新repo init/repo sync,就再没有任何问题了!

0 0
原创粉丝点击