Linux 无法通过公钥ssh登录

Linux 无法通过公钥ssh登录,linux,git,ssh,Linux,Git,Ssh,我正在尝试使用ssh设置公钥登录,这是我以前毫无困难地完成的。然而,这次我仍然被提示输入密码,我不知道为什么。我已经找到了很多解决这个问题的办法,但似乎没有一个适用于我 以下是如何设置我的本地主机: drwx------ 2 dave dave 4096 Mar 3 20:41 . drwx------ 20 dave dave 4096 Mar 3 19:52 .. -rw------- 1 dave dave 1675 Mar 3 20:12 id_rsa -rw-r--r--

我正在尝试使用ssh设置公钥登录,这是我以前毫无困难地完成的。然而,这次我仍然被提示输入密码,我不知道为什么。我已经找到了很多解决这个问题的办法,但似乎没有一个适用于我

以下是如何设置我的本地主机:

drwx------  2 dave dave 4096 Mar  3 20:41 .
drwx------ 20 dave dave 4096 Mar  3 19:52 ..
-rw-------  1 dave dave 1675 Mar  3 20:12 id_rsa
-rw-r--r--  1 dave dave  385 Mar  3 20:12 id_rsa.pub
-rw-r--r--  1 dave dave  444 Mar  3 20:07 known_hosts
drwx------ 2 git git 4096 Mar  3 20:33 .
drwxr-x--- 4 git git 4096 Mar  3 20:13 ..
-rw------- 1 git git  770 Mar  3 20:41 authorized_keys
以下是如何设置我的远程主机:

drwx------  2 dave dave 4096 Mar  3 20:41 .
drwx------ 20 dave dave 4096 Mar  3 19:52 ..
-rw-------  1 dave dave 1675 Mar  3 20:12 id_rsa
-rw-r--r--  1 dave dave  385 Mar  3 20:12 id_rsa.pub
-rw-r--r--  1 dave dave  444 Mar  3 20:07 known_hosts
drwx------ 2 git git 4096 Mar  3 20:33 .
drwxr-x--- 4 git git 4096 Mar  3 20:13 ..
-rw------- 1 git git  770 Mar  3 20:41 authorized_keys
我尝试使用以下命令进行连接(用于调试):

服务器(在调试模式下)生成:

debug2:fd 4设置O_非块
debug3:sock\u set\u v6only:set socket 4 IPV6\u v6only
debug1:绑定到上的端口222:。
正在侦听的服务器::端口222。
调试3:fd 5不是O_非块
debug1:服务器在调试模式下运行时不会分叉。
debug3:发送\u rexec\u状态:输入fd=8配置len 811
debug3:ssh\u msg\u发送:类型0
debug3:发送\u rexec\u状态:完成
debug1:rexec开始5进5出5新存储5管道-1存储8
debug1:复制后的inetd套接字:3,3
从10.1.2.2端口51832到10.2.1.1端口222的连接
debug1:客户端协议版本2.0;客户端软件版本OpenSSH_6.9p1 Ubuntu-2ubuntu0.1
debug1:match:OpenSSH_6.9p1 Ubuntu-2ubuntu0.1 pat OpenSSH*compat 0x04000000
debug1:启用协议2.0的兼容模式
debug1:本地版本字符串SSH-2.0-OpenSSH_6.7p1 Debian-5+deb8u1
调试2:fd 3设置O_非块
debug2:网络子节点位于pid 11031上
debug3:已启动预授权子监视器
debug3:privesep用户:组107:65534[预授权]
debug1:永久设置uid:107/65534[预授权]
debug1:列出\u主机密钥\u类型:ssh rsa、ssh dss、ecdsa-sha2-nistp256、ssh-ed25519[预授权]
debug1:SSH2\u MSG\u KEXINIT已发送[预授权]
debug1:SSH2\u MSG\u KEXINIT已接收[预授权]
debug2:kex_parse_kexinit:curve25519-sha256@libssh.org,ecdh-sha2-nistp256,ecdh-sha2-nistp384,ecdh-sha2-nistp521,diffie-hellman-group-exchange-sha256,diffie-hellman-group14-sha1[预授权]
debug2:kex_parse_kexinit:ssh rsa,ssh dss,ecdsa-sha2-nistp256,ssh-ed25519[预授权]
debug2:kex_parse_kexinit:aes128 ctr、aes192 ctr、aes256 ctr、aes128-gcm@openssh.com,aes256-gcm@openssh.com,chacha20-poly1305@openssh.com[预授权]
debug2:kex_parse_kexinit:aes128 ctr、aes192 ctr、aes256 ctr、aes128-gcm@openssh.com,aes256-gcm@openssh.com,chacha20-poly1305@openssh.com[预授权]
debug2:kex_parse_kexinit:umac-64-etm@openssh.com,umac-128-etm@openssh.com,hmac-sha2-256-etm@openssh.com,hmac-sha2-512-etm@openssh.com,hmac-sha1-etm@openssh.com,umac-64@openssh.com,umac-128@openssh.com,hmac-sha2-256,hmac-sha2-512,hmac-sha1[预授权]
debug2:kex_parse_kexinit:umac-64-etm@openssh.com,umac-128-etm@openssh.com,hmac-sha2-256-etm@openssh.com,hmac-sha2-512-etm@openssh.com,hmac-sha1-etm@openssh.com,umac-64@openssh.com,umac-128@openssh.com,hmac-sha2-256,hmac-sha2-512,hmac-sha1[预授权]
debug2:kex_parse_kexinit:none,zlib@openssh.com[预授权]
debug2:kex_parse_kexinit:none,zlib@openssh.com[预授权]
debug2:kex_parse_kexinit:[预授权]
debug2:kex_parse_kexinit:[预授权]
debug2:kex_parse_kexinit:first_kex_跟在0后面[preauth]
debug2:kex_parse_kexinit:保留0[预授权]
debug2:kex_parse_kexinit:curve25519-sha256@libssh.org,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:ecdsa-sha2-nistp256-cert-v01@openssh.com,ecdsa-sha2-nistp384-cert-v01@openssh.com,ecdsa-sha2-nistp521-cert-v01@openssh.com,ssh-ed25519-cert-v01@openssh.com,ssh rsa证书-v01@openssh.com,ssh-dss证书-v01@openssh.com,ssh rsa证书-v00@openssh.com,ssh-dss证书-v00@openssh.com,ecdsa-sha2-nistp256,ecdsa-sha2-nistp384,ecdsa-sha2-nistp521,ssh-ed25519,ssh rsa,ssh dss[预授权]
debug2:kex_parse_kexinit:chachacha20-poly1305@openssh.com,aes128中心,aes192中心,aes256中心,aes128-gcm@openssh.com,aes256-gcm@openssh.com,arcfour256,arcfour128,aes128 cbc,3des cbc,河豚cbc,cast128 cbc,aes192 cbc,aes256 cbc,arcfour,rijndael-cbc@lysator.liu.se[预授权]
debug2:kex_parse_kexinit:chachacha20-poly1305@openssh.com,aes128中心,aes192中心,aes256中心,aes128-gcm@openssh.com,aes256-gcm@openssh.com,arcfour256,arcfour128,aes128 cbc,3des cbc,河豚cbc,cast128 cbc,aes192 cbc,aes256 cbc,arcfour,rijndael-cbc@lysator.liu.se[预授权]
debug2:kex_parse_kexinit:umac-64-etm@openssh.com,umac-128-etm@openssh.com,hmac-sha2-256-etm@openssh.com,hmac-sha2-512-etm@openssh.com,hmac-sha1-etm@openssh.com,umac-64@openssh.com,umac-128@openssh.com,hmac-sha2-256,hmac-sha2-512,hmac-sha1,hmac-md5-etm@openssh.com,hmac-ripemd160-etm@openssh.com,hmac-sha1-96-etm@openssh.com,hmac-md5-96-etm@openssh.com,hmac-md5,hmac-ripemd160,hmac-ripemd160@openssh.com,hmac-sha1-96,hmac-md5-96[预授权]
debug2:kex_parse_kexinit:umac-64-etm@openssh.com,umac-128-etm@openssh.com,hmac-sha2-256-etm@openssh.com,hmac-sha2-512-etm@openssh.com,hmac-sha1-etm@openssh.com,umac-64@openssh.com,umac-128@openssh.com,hmac-sha2-256,hmac-sha2-512,hmac-sha1,hmac-md5-etm@openssh.com,hmac-ripemd160-etm@openssh.com,hmac-sha1-96-etm@openssh.com,hmac-md5-96-etm@openssh.com,hmac-md5,hmac-ripemd160,hmac-ripemd160@openssh.com,hmac-sha1-96,hmac-md5-96[预授权]
debug2:kex_parse_kexinit:none,zlib@openssh.com,zlib[preauth]
debug2:kex_parse_kexinit:none,zlib@openssh.com,zlib[preauth]
debug2:kex_parse_kexinit:[预授权]
debug2:kex_parse_kexinit:[预授权]
debug2:kex_parse_kexinit:first_kex_跟在0后面[preauth]
debug2:kex_parse_kexinit:保留0[预授权]
debug1:kex:client->server chacha20-poly1305@openssh.com无[预授权]
debug1:kex:server->client chacha20-poly1305@openssh.com无[预授权]
debug1:应为SSH2\u MSG\u KEX\u ECDH\u INIT[preauth]
调试3:mm_键_符号输入[预授权]
debug3:mm_请求_发送输入:键入6[预授权]
debug3:mm_键\u符号:等待监视器\u和\u符号[预授权]
debug3:mm\u请求\u接收\u期望输入:类型7[预授权]
debug3:mm_请求_接收输入[预授权]
debug3:mm_请求_接收输入
debug3:监视器读取:检查请求6
调试3:mm\U应答\U符号
调试3:mm_a
OpenSSH_6.9p1 Ubuntu-2ubuntu0.1, OpenSSL 1.0.2d 9 Jul 2015
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.2.1.1 [10.2.1.1] port 222.
debug1: Connection established.
debug1: identity file /home/dave/.ssh/id_rsa.pub type 1
debug1: key_load_public: No such file or directory
debug1: identity file /home/dave/.ssh/id_rsa.pub-cert type -1
debug1: Enabling compatibility mode for protocol 2.0
debug1: Local version string SSH-2.0-OpenSSH_6.9p1 Ubuntu-2ubuntu0.1
debug1: Remote protocol version 2.0, remote software version OpenSSH_6.7p1 Debian-5+deb8u1
debug1: match: OpenSSH_6.7p1 Debian-5+deb8u1 pat OpenSSH* compat 0x04000000
debug2: fd 3 setting O_NONBLOCK

debug1: Authenticating to 10.2.1.1:222 as 'git'
debug3: put_host_port: [10.2.1.1]:222
debug3: hostkeys_foreach: reading file "/home/dave/.ssh/known_hosts"
debug1: SSH2_MSG_KEXINIT sent
debug1: SSH2_MSG_KEXINIT received
debug2: kex_parse_kexinit: curve25519-sha256@libssh.org,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: ecdsa-sha2-nistp256-cert-v01@openssh.com,ecdsa-sha2-nistp384-cert-v01@openssh.com,ecdsa-sha2-nistp521-cert-v01@openssh.com,ssh-ed25519-cert-v01@openssh.com,ssh-rsa-cert-v01@openssh.com,ssh-dss-cert-v01@openssh.com,ssh-rsa-cert-v00@openssh.com,ssh-dss-cert-v00@openssh.com,ecdsa-sha2-nistp256,ecdsa-sha2-nistp384,ecdsa-sha2-nistp521,ssh-ed25519,ssh-rsa,ssh-dss
debug2: kex_parse_kexinit: chacha20-poly1305@openssh.com,aes128-ctr,aes192-ctr,aes256-ctr,aes128-gcm@openssh.com,aes256-gcm@openssh.com,arcfour256,arcfour128,aes128-cbc,3des-cbc,blowfish-cbc,cast128-cbc,aes192-cbc,aes256-cbc,arcfour,rijndael-cbc@lysator.liu.se
debug2: kex_parse_kexinit: chacha20-poly1305@openssh.com,aes128-ctr,aes192-ctr,aes256-ctr,aes128-gcm@openssh.com,aes256-gcm@openssh.com,arcfour256,arcfour128,aes128-cbc,3des-cbc,blowfish-cbc,cast128-cbc,aes192-cbc,aes256-cbc,arcfour,rijndael-cbc@lysator.liu.se
debug2: kex_parse_kexinit: umac-64-etm@openssh.com,umac-128-etm@openssh.com,hmac-sha2-256-etm@openssh.com,hmac-sha2-512-etm@openssh.com,hmac-sha1-etm@openssh.com,umac-64@openssh.com,umac-128@openssh.com,hmac-sha2-256,hmac-sha2-512,hmac-sha1,hmac-md5-etm@openssh.com,hmac-ripemd160-etm@openssh.com,hmac-sha1-96-etm@openssh.com,hmac-md5-96-etm@openssh.com,hmac-md5,hmac-ripemd160,hmac-ripemd160@openssh.com,hmac-sha1-96,hmac-md5-96
debug2: kex_parse_kexinit: umac-64-etm@openssh.com,umac-128-etm@openssh.com,hmac-sha2-256-etm@openssh.com,hmac-sha2-512-etm@openssh.com,hmac-sha1-etm@openssh.com,umac-64@openssh.com,umac-128@openssh.com,hmac-sha2-256,hmac-sha2-512,hmac-sha1,hmac-md5-etm@openssh.com,hmac-ripemd160-etm@openssh.com,hmac-sha1-96-etm@openssh.com,hmac-md5-96-etm@openssh.com,hmac-md5,hmac-ripemd160,hmac-ripemd160@openssh.com,hmac-sha1-96,hmac-md5-96
debug2: kex_parse_kexinit: none,zlib@openssh.com,zlib
debug2: kex_parse_kexinit: none,zlib@openssh.com,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: curve25519-sha256@libssh.org,ecdh-sha2-nistp256,ecdh-sha2-nistp384,ecdh-sha2-nistp521,diffie-hellman-group-exchange-sha256,diffie-hellman-group14-sha1
debug2: kex_parse_kexinit: ssh-rsa,ssh-dss,ecdsa-sha2-nistp256,ssh-ed25519
debug2: kex_parse_kexinit: aes128-ctr,aes192-ctr,aes256-ctr,aes128-gcm@openssh.com,aes256-gcm@openssh.com,chacha20-poly1305@openssh.com
debug2: kex_parse_kexinit: aes128-ctr,aes192-ctr,aes256-ctr,aes128-gcm@openssh.com,aes256-gcm@openssh.com,chacha20-poly1305@openssh.com
debug2: kex_parse_kexinit: umac-64-etm@openssh.com,umac-128-etm@openssh.com,hmac-sha2-256-etm@openssh.com,hmac-sha2-512-etm@openssh.com,hmac-sha1-etm@openssh.com,umac-64@openssh.com,umac-128@openssh.com,hmac-sha2-256,hmac-sha2-512,hmac-sha1
debug2: kex_parse_kexinit: umac-64-etm@openssh.com,umac-128-etm@openssh.com,hmac-sha2-256-etm@openssh.com,hmac-sha2-512-etm@openssh.com,hmac-sha1-etm@openssh.com,umac-64@openssh.com,umac-128@openssh.com,hmac-sha2-256,hmac-sha2-512,hmac-sha1
debug2: kex_parse_kexinit: none,zlib@openssh.com
debug2: kex_parse_kexinit: none,zlib@openssh.com
debug2: kex_parse_kexinit: 
debug2: kex_parse_kexinit: 
debug2: kex_parse_kexinit: first_kex_follows 0 
debug2: kex_parse_kexinit: reserved 0 
debug1: kex: server->client chacha20-poly1305@openssh.com <implicit> none
debug1: kex: client->server chacha20-poly1305@openssh.com <implicit> none
debug1: expecting SSH2_MSG_KEX_ECDH_REPLY
debug1: Server host key: ecdsa-sha2-nistp256 SHA256:4t4CmmuHE5EwyaYDleCj9h99kxQTeJrLcNGOOC2wMAU
debug3: put_host_port: [10.2.1.1]:222
debug3: put_host_port: [10.2.1.1]:222
debug3: hostkeys_foreach: reading file "/home/dave/.ssh/known_hosts"
debug3: hostkeys_foreach: reading file "/home/dave/.ssh/known_hosts"
debug1: checking without port identifier
debug3: hostkeys_foreach: reading file "/home/dave/.ssh/known_hosts"
debug3: record_hostkey: found key type ECDSA in file /home/dave/.ssh/known_hosts:1
debug3: load_hostkeys: loaded 1 keys from 10.2.1.1
debug1: Host '10.2.1.1' is known and matches the ECDSA host key.
debug1: Found key in /home/dave/.ssh/known_hosts:1
debug1: found matching key w/out port
debug2: set_newkeys: mode 1
debug1: SSH2_MSG_NEWKEYS sent
debug1: expecting SSH2_MSG_NEWKEYS
debug2: set_newkeys: mode 0
debug1: SSH2_MSG_NEWKEYS received
debug1: SSH2_MSG_SERVICE_REQUEST sent
debug2: service_accept: ssh-userauth
debug1: SSH2_MSG_SERVICE_ACCEPT received
debug2: key: /home/dave/.ssh/id_rsa.pub (0x5571a91c1f60), explicit
debug1: Authentications that can continue: publickey,password
debug3: start over, passed a different list publickey,password
debug3: preferred gssapi-keyex,gssapi-with-mic,publickey,keyboard-interactive,password
debug3: authmethod_lookup publickey
debug3: remaining preferred: keyboard-interactive,password
debug3: authmethod_is_enabled publickey
debug1: Next authentication method: publickey
debug1: Offering RSA public key: /home/dave/.ssh/id_rsa.pub
debug3: send_pubkey_test
debug2: we sent a publickey packet, wait for reply
debug1: Server accepts key: pkalg ssh-rsa blen 279
debug2: input_userauth_pk_ok: fp SHA256:Jn4FQWeVvzzM/ybsRJYRvQYW8Ofjs9lEAEseol7l5b4
debug3: sign_and_send_pubkey: RSA SHA256:Jn4FQWeVvzzM/ybsRJYRvQYW8Ofjs9lEAEseol7l5b4
debug2: we did not send a packet, disable method
debug3: authmethod_lookup password
debug3: remaining preferred: ,password
debug3: authmethod_is_enabled password
debug1: Next authentication method: password
git@10.2.1.1's password: 
ssh git@10.2.1.1 -i ~/.ssh/id_rsa.pub -vvv -p 222
ssh git@10.2.1.1 -i ~/.ssh/id_rsa -vvv -p 222