GVKun编程网logo

linux ssh连接 出现 Host key verification failed 错误 解决方法(sshd no hostkeys available)

3

本文的目的是介绍linuxssh连接出现Hostkeyverificationfailed错误解决方法的详细情况,特别关注sshdnohostkeysavailable的相关信息。我们将通过专业的研究

本文的目的是介绍linux ssh连接 出现 Host key verification failed 错误 解决方法的详细情况,特别关注sshd no hostkeys available的相关信息。我们将通过专业的研究、有关数据的分析等多种方式,为您呈现一个全面的了解linux ssh连接 出现 Host key verification failed 错误 解决方法的机会,同时也不会遗漏关于"msg": "Using a SSH password instead of a key is not possible because Host Key che...、ansible 报错 Using a SSH password instead of a key is not possible because Host Key checking is enabl...、docker build时报错"failed to create endpoint xxxx on network bridge: failed to add the host (veth999...、Failed to open the host key database file的知识。

本文目录一览:

linux ssh连接 出现 Host key verification failed 错误 解决方法(sshd no hostkeys available)

linux ssh连接 出现 Host key verification failed 错误 解决方法(sshd no hostkeys available)

错误现象:

[root@cache001 swftools-0.9.0]# ssh 192.168.1.90
@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
@    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
05:25:84:ea:dd:92:8d:80:ce:ad:5b:79:58:fe:c9:42.
Please contact your system administrator.
Add correct host key in /root/.ssh/kNown_hosts to get rid of this message.
Offending key in /root/.ssh/kNown_hosts:10
RSA host key for 192.168.1.90 has changed and you have requested strict checking.
Host key verification Failed.

 

原因:

用OpenSSH的人都知ssh会把你每个你访问过计算机的公钥(public key)都记录在~/.ssh/kNown_hosts。当下次访问相同计算机时,OpenSSH会核对公钥。如果公钥不同,OpenSSH会发出警告,避免你受到DNS Hijack之类的攻击。
SSH对主机的public_key的检查等级是根据StrictHostKeyChecking变量来配置的。默认情况下,StrictHostKeyChecking=ask。简单所下它的三种配置值:

1.
StrictHostKeyChecking=no  

#最不安全的级别,当然也没有那么多烦人的提示了,相对安全的内网时建议使用。如果连接server的key在本地不存在,那么就自动添加到文件中(默认是kNown_hosts),并且给出一个警告。

2.
StrictHostKeyChecking=ask  #默认的级别,就是出现刚才的提示了。如果连接和key不匹配,给出提示,并拒绝登录。

3.
StrictHostKeyChecking=yes  #最安全的级别,如果连接与key不匹配,就拒绝连接,不会提示详细信息。


解决方法:

方法 1

对于我来说,在内网的进行的一些测试,为了方便,选择最低的安全级别。在.ssh/config(或者/etc/ssh/ssh_config)中配置:

StrictHostKeyChecking no
UserKNownHostsFile /dev/null

(注:这里为了简便,将kNownhostfile设为/dev/null,就不保存在kNown_hosts中了)

 

方法 2

vi ~/.ssh/kNown_hosts

删除对应ip的相关rsa信息

 

方法 3

rm ~/.ssh/kNown_hosts

 

 

"msg": "Using a SSH password instead of a key is not possible because Host Key che...

Centos7.5 ansible第一次使用模块报错

问题:

[root@m01 ~]# ansible webservers -m ping -i ./hosts
172.16.1.7 | FAILED! => {
    "msg": "Using a SSH password instead of a key is not possible because Host Key checking is enabled and sshpass does not support this.  Please add this host''s fingerprint to your known_hosts file to manage this host."
}
172.16.1.8 | FAILED! => {
    "msg": "Using a SSH password instead of a key is not possible because Host Key checking is enabled and sshpass does not support this.  Please add this host''s fingerprint to your known_hosts file to manage this host."
}

产生的原因:

如果控制端和被控制端第一次通讯,需要先添加指纹信息

解决方法:

添加指纹信息
[root@m01 ~]# ssh 172.16.1.7
The authenticity of host ''172.16.1.7 (172.16.1.7)'' can''t be established.
ECDSA key fingerprint is SHA256:KS0T63CVc6vyFB3MHXLjPGCuTL3AIaNR5Jk1D92pW8Q.
ECDSA key fingerprint is MD5:5e:6e:7e:90:16:0c:0e:c3:a2:3d:73:2a:9a:be:40:aa.
Are you sure you want to continue connecting (yes/no)? yes
root@172.16.1.7''s password: 输入密码
Last login: Tue Feb 26 15:58:50 2019 from 10.0.0.1
[root@web01 ~]# exit
logout
Connection to 172.16.1.7 closed.
[root@m01 ~]# ansible web01 -m ping -i ./hosts	
172.16.1.7 | SUCCESS => {
    "changed": false, 
    "ping": "pong"
}

那如果机器特别多少的情况下怎么办?

仅需开启ansible中的 host_key_checking = False
[root@m01 ~]# vim /etc/ansible/ansible.cfg 
host_key_checking = False
[root@m01 ~]# ansible webservers -m ping -i ./hosts
172.16.1.7 | SUCCESS => {
    "changed": false, 
    "ping": "pong"
}
172.16.1.8 | SUCCESS => {
    "changed": false, 
    "ping": "pong"
}

ansible 报错 Using a SSH password instead of a key is not possible because Host Key checking is enabl...

ansible 报错 Using a SSH password instead of a key is not possible because Host Key checking is enabl...

安装和配置好 ansible,执行命令时报错如下

[root@test01 ansible-install]# ansible test -m shell -a ''w''
10.xx.37.26 | FAILED | rc=-1 >>
Using a SSH password instead of a key is not possible because Host Key checking is enabled and sshpass does not support this.  Please add this host''s fingerprint to your known_hosts file to manage this host.

10.xx.37.25 | FAILED | rc=-1 >>
Using a SSH password instead of a key is not possible because Host Key checking is enabled and sshpass does not support this.  Please add this host''s fingerprint to your known_hosts file to manage this host.

10.xx.37.24 | FAILED | rc=-1 >>
Using a SSH password instead of a key is not possible because Host Key checking is enabled and sshpass does not support this.  Please add this host''s fingerprint to your known_hosts file to manage this host.

 

解决方法:

vi /etc/ansible/ansible.cfg
[defaults]
forks          = 8           #执行时并发数
host_key_checking = False    #不检测host key

 

docker build时报错

docker build时报错"failed to create endpoint xxxx on network bridge: failed to add the host (veth999...

答: 加载内核模块veth(CONFIG_VETH)

  1. 检查内核模块是否被加载
    $ modinfo veth
  2. 加载内核模块
    $ sudo modprobe veth

Failed to open the host key database file

Failed to open the host key database file

【直播预告】程序员逆袭 CEO 分几步?

win7 使用 secureCRT 连接的时候弹出以上错误提示

解决办法:

进入 D:\aniu\project\SecureCRTSecureFX_HH_x86_7.0.0.326\Data\Settings\Config

(我的 secureCRT 是放在桌面上的,以上目录根据具体情况而定)

打开 SSH2.ini,将内容修改为以下,并保存

S:"Host Key Database Location"=D:\aniu\project\SecureCRTSecureFX_HH_x86_7.0.0.326\Data\Settings\Config\KnownHosts

这个时候会生成 SSH2.ini.bak,删掉

重启 secureCRT,恢复正常

今天的关于linux ssh连接 出现 Host key verification failed 错误 解决方法sshd no hostkeys available的分享已经结束,谢谢您的关注,如果想了解更多关于"msg": "Using a SSH password instead of a key is not possible because Host Key che...、ansible 报错 Using a SSH password instead of a key is not possible because Host Key checking is enabl...、docker build时报错"failed to create endpoint xxxx on network bridge: failed to add the host (veth999...、Failed to open the host key database file的相关知识,请在本站进行查询。

本文标签: