OpenSSH_5.9p1 客户端不会添加新连接?

OpenSSH_5.9p1 客户端不会添加新连接?

我正在运行 Ubuntu 12.04 ssh 服务器/客户端,以便将文件发送给我们合作的供应商。最近,我尝试通过向他们发送我的id_rsa.pub文件来添加新供应商,但无法连接。我一直在本地测试,发现我的 ssh 客户端无法连接到任何新服务器。ssh 客户端从不提出标准问题,即

主机 xxxx 的真实性........您确定要继续连接吗(是/否)。

我尝试连接三台本地服务器,但结果都一样。所有其他客户端都可以正常连接这三台服务器。

我无法连接到这些服务器,除非我将我的导出id_rsa.pub到他们的authorized_keys

如果我将公钥放在这些服务器上,它仍然会失败

主机密钥验证失败

从不要求输入密码短语。我的解决方法是ssh -o StrictHostKeyChecking=no user@server。只有在我将我的导出id_rsa.pub到远程后authorized_keys

那么问题是为什么从来没有要求我向“known_hosts”添加新密钥,为什么我必须导出公钥才能连接?

  • 我已经重新安装了 ssh 客户端,没有变化。
  • known_hosts用清除了文件ssh-keygen -R x.x.x.x
  • 删除了该known_hosts文件。
  • 清除钥匙串:ran eval "$(ssh-agent)", ssh-add -D, and ssh-add
  • 对于known_hosts权限我已尝试 600 和 644。

谢谢

netmgr@FTP-Inside:~/.ssh$ ssh -vvv [email protected]
OpenSSH_5.9p1 Debian-5ubuntu1.1, OpenSSL 1.0.1 14 Mar 2012
debug1: Reading configuration data /etc/ssh/ssh_config
debug1: /etc/ssh/ssh_config line 19: Applying options for *
debug2: ssh_connect: needpriv 0
debug1: Connecting to 10.20.11.11 [10.20.11.11] port 22.
debug1: Connection established.
debug3: Incorrect RSA1 identifier
debug3: Could not load "/home/netmgr/.ssh/id_rsa" as a RSA1 public key
debug1: identity file /home/netmgr/.ssh/id_rsa type 1
debug1: Checking blacklist file /usr/share/ssh/blacklist.RSA-2048
debug1: Checking blacklist file /etc/ssh/blacklist.RSA-2048
debug1: identity file /home/netmgr/.ssh/id_rsa-cert type -1
debug3: Incorrect RSA1 identifier
debug3: Could not load "/home/netmgr/.ssh/id_dsa" as a RSA1 public key
debug1: identity file /home/netmgr/.ssh/id_dsa type 2
debug1: Checking blacklist file /usr/share/ssh/blacklist.DSA-1024
debug1: Checking blacklist file /etc/ssh/blacklist.DSA-1024
debug1: identity file /home/netmgr/.ssh/id_dsa-cert type -1
debug1: identity file /home/netmgr/.ssh/id_ecdsa type -1
debug1: identity file /home/netmgr/.ssh/id_ecdsa-cert type -1
debug1: Remote protocol version 2.0, remote software version OpenSSH_4.3
debug1: match: OpenSSH_4.3 pat OpenSSH_4*
debug1: Enabling compatibility mode for protocol 2.0
debug1: Local version string SSH-2.0-OpenSSH_5.9p1 Debian-5ubuntu1.1
debug2: fd 3 setting O_NONBLOCK
debug3: load_hostkeys: loading entries for host "10.20.11.11" from file "/home/netmgr/.ssh/known_hosts"
debug3: load_hostkeys: loaded 0 keys
debug1: SSH2_MSG_KEXINIT sent
debug1: SSH2_MSG_KEXINIT received
debug2: kex_parse_kexinit: ecdh-sha2-nistp256,ecdh-sha2-nistp384,ecdh-sha2-nistp521,diffie-hellman-group-exchange-sha256,diffie-hellman-group-exchange-sha1,diffie-hellman-group14-sha1,diffie-hellman-group1-sha1
debug2: kex_parse_kexinit: [email protected],[email protected],[email protected],[email protected],[email protected],[email protected],[email protected],ecdsa-sha2-nistp256,ecdsa-sha2-nistp384,ecdsa-sha2-nistp521,ssh-rsa,ssh-dss
debug2: kex_parse_kexinit: aes128-ctr,aes192-ctr,aes256-ctr,arcfour256,arcfour128,aes128-cbc,3des-cbc,blowfish-cbc,cast128-cbc,aes192-cbc,aes256-cbc,arcfour,[email protected]
debug2: kex_parse_kexinit: aes128-ctr,aes192-ctr,aes256-ctr,arcfour256,arcfour128,aes128-cbc,3des-cbc,blowfish-cbc,cast128-cbc,aes192-cbc,aes256-cbc,arcfour,[email protected]
debug2: kex_parse_kexinit: hmac-md5,hmac-sha1,[email protected],hmac-sha2-256,hmac-sha2-256-96,hmac-sha2-512,hmac-sha2-512-96,hmac-ripemd160,[email protected],hmac-sha1-96,hmac-md5-96
debug2: kex_parse_kexinit: hmac-md5,hmac-sha1,[email protected],hmac-sha2-256,hmac-sha2-256-96,hmac-sha2-512,hmac-sha2-512-96,hmac-ripemd160,[email protected],hmac-sha1-96,hmac-md5-96
debug2: kex_parse_kexinit: none,[email protected],zlib
debug2: kex_parse_kexinit: none,[email protected],zlib
debug2: kex_parse_kexinit: 
debug2: kex_parse_kexinit: 
debug2: kex_parse_kexinit: first_kex_follows 0 
debug2: kex_parse_kexinit: reserved 0 
debug2: kex_parse_kexinit: diffie-hellman-group-exchange-sha1,diffie-hellman-group14-sha1,diffie-hellman-group1-sha1
debug2: kex_parse_kexinit: ssh-rsa,ssh-dss
debug2: kex_parse_kexinit: aes128-ctr,aes192-ctr,aes256-ctr,arcfour256,arcfour128,aes128-cbc,3des-cbc,blowfish-cbc,cast128-cbc,aes192-cbc,aes256-cbc,arcfour,[email protected]
debug2: kex_parse_kexinit: aes128-ctr,aes192-ctr,aes256-ctr,arcfour256,arcfour128,aes128-cbc,3des-cbc,blowfish-cbc,cast128-cbc,aes192-cbc,aes256-cbc,arcfour,[email protected]
debug2: kex_parse_kexinit: hmac-md5,hmac-sha1,hmac-ripemd160,[email protected],hmac-sha1-96,hmac-md5-96
debug2: kex_parse_kexinit: hmac-md5,hmac-sha1,hmac-ripemd160,[email protected],hmac-sha1-96,hmac-md5-96
debug2: kex_parse_kexinit: none,[email protected]
debug2: kex_parse_kexinit: none,[email protected]
debug2: kex_parse_kexinit: 
debug2: kex_parse_kexinit: 
debug2: kex_parse_kexinit: first_kex_follows 0 
debug2: kex_parse_kexinit: reserved 0 
debug2: mac_setup: found hmac-md5
debug1: kex: server->client aes128-ctr hmac-md5 none
debug2: mac_setup: found hmac-md5
debug1: kex: client->server aes128-ctr hmac-md5 none
debug1: SSH2_MSG_KEX_DH_GEX_REQUEST(1024<1024<8192) sent
debug1: expecting SSH2_MSG_KEX_DH_GEX_GROUP
debug2: dh_gen_key: priv key bits set: 110/256
debug2: bits set: 496/1024
debug1: SSH2_MSG_KEX_DH_GEX_INIT sent
debug1: expecting SSH2_MSG_KEX_DH_GEX_REPLY
debug1: Server host key: RSA a3:03:06:34:55:04:b8:71:8f:b7:65:cc:43:a5:58:43
debug3: load_hostkeys: loading entries for host "10.20.11.11" from file "/home/netmgr/.ssh/known_hosts"
debug3: load_hostkeys: loaded 0 keys
Host key verification failed.

答案1

全局配置文件/etc/ssh_config具有以下指令:

BatchMode yes

这会抑制密码挑战。注释掉该行即可解决问题。

答案2

检查服务器是否允许密码验证。要共享密钥,您需要登录一次,并且需要密码验证,除非像authorized_keys您一样在服务器端手动将密钥添加到远程文件中。

在服务器端编辑/etc/ssh/sshd_config如下:

# Change to no to disable tunnelled clear text passwords
PasswordAuthentication yes

sudo service ssh restart在服务器上重新启动 ssh 服务器。

现在将您的密钥发送到服务器ssh-copy-id username@remotehost

当密钥位于远程服务器上时,您可以按照启用密码验证的/etc/ssh/sshd_config相同方式禁用密码验证,并记得在服务器上重新启动 ssh。

相关内容