質問: sshキー認証が失敗する 私は管理できないcentosサーバーにsshで接続しようとしています。管理者が私の公開鍵をサーバーに追加し、問題は私にあると主張しますが、何が悪いのかわかりません。.sshで設定します。tim@tim-ux31a:~$ cat ~/.ssh/config user root passwordauthentication no identityfile ~/.ssh/id_rsa 私のキーファイルの許可:tim@tim-ux31a:~$ ls -l ~/.ssh/id_rsa* -rw------- 1 tim tim 3326 okt 20 17:28 /home/tim/.ssh/id_rsa -rw-r--r-- 1 tim tim 746 okt 20 17:28 /home/tim/.ssh/id_rsa.pub 意味がわからない接続ログtim@tim-ux31a:~$ ssh -vvv root@10.0.12.28 openssh_7.2p2 ubuntu-4ubuntu2.1, openssl 1.0.2g 1 mar 2016 debug1: reading configuration data /home/tim/.ssh/config debug1: reading configuration data /etc/ssh/ssh_config debug1: /etc/ssh/ssh_config line 19: applying options for * debug2: resolving "10.0.12.28" port 22 debug2: ssh_connect_direct: needpriv 0 debug1: connecting to 10.0.12.28 [10.0.12.28] port 22. debug1: connection established. debug1: identity file /home/tim/.ssh/id_rsa type 1 debug1: key_load_public: no such file or directory debug1: identity file /home/tim/.ssh/id_rsa-cert type -1 debug1: enabling compatibility mode for protocol 2.0 debug1: local version string ssh-2.0-openssh_7.2p2 ubuntu-4ubuntu2.1 debug1: remote protocol version 2.0, remote software version openssh_6.6.1 debug1: match: openssh_6.6.1 pat openssh_6.6.1* compat 0x04000000 debug2: fd 3 setting o_nonblock debug1: authenticating to 10.0.12.28:22 as 'root' debug3: hostkeys_foreach: reading file "/home/tim/.ssh/known_hosts" debug3: record_hostkey: found key type ecdsa in file /home/tim/.ssh/known_hosts:3 debug3: load_hostkeys: loaded 1 keys from 10.0.12.28 debug3: order_hostkeyalgs: prefer hostkeyalgs: ecdsa-sha2-nistp256-cert-v01@openssh.com,ecdsa-sha2-nistp384-cert-v01@openssh.com,ecdsa-sha2-nistp521-cert-v01@openssh.com,ecdsa-sha2-nistp256,ecdsa-sha2-nistp384,ecdsa-sha2-nistp521 debug3: send packet: type 20 debug1: ssh2_msg_kexinit sent debug3: receive packet: type 20 debug1: ssh2_msg_kexinit received debug2: local client kexinit proposal debug2: kex algorithms: 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,ext-info-c debug2: host key algorithms: ecdsa-sha2-nistp256-cert-v01@openssh.com,ecdsa-sha2-nistp384-cert-v01@openssh.com,ecdsa-sha2-nistp521-cert-v01@openssh.com,ecdsa-sha2-nistp256,ecdsa-sha2-nistp384,ecdsa-sha2-nistp521,ssh-ed25519-cert-v01@openssh.com,ssh-rsa-cert-v01@openssh.com,ssh-ed25519,rsa-sha2-512,rsa-sha2-256,ssh-rsa debug2: ciphers ctos: chacha20-poly1305@openssh.com,aes128-ctr,aes192-ctr,aes256-ctr,aes128-gcm@openssh.com,aes256-gcm@openssh.com,aes128-cbc,aes192-cbc,aes256-cbc,3des-cbc debug2: ciphers stoc: chacha20-poly1305@openssh.com,aes128-ctr,aes192-ctr,aes256-ctr,aes128-gcm@openssh.com,aes256-gcm@openssh.com,aes128-cbc,aes192-cbc,aes256-cbc,3des-cbc debug2: macs ctos: 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: macs stoc: 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: compression ctos: none,zlib@openssh.com,zlib debug2: compression stoc: none,zlib@openssh.com,zlib debug2: languages ctos: debug2: languages stoc: debug2: first_kex_follows 0 debug2: reserved 0 debug2: peer server kexinit proposal debug2: kex algorithms: 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: host key algorithms: ssh-rsa,ecdsa-sha2-nistp256 debug2: ciphers ctos: aes128-ctr,aes192-ctr,aes256-ctr,arcfour256,arcfour128,aes128-gcm@openssh.com,aes256-gcm@openssh.com,chacha20-poly1305@openssh.com,aes128-cbc,3des-cbc,blowfish-cbc,cast128-cbc,aes192-cbc,aes256-cbc,arcfour,rijndael-cbc@lysator.liu.se debug2: ciphers stoc: aes128-ctr,aes192-ctr,aes256-ctr,arcfour256,arcfour128,aes128-gcm@openssh.com,aes256-gcm@openssh.com,chacha20-poly1305@openssh.com,aes128-cbc,3des-cbc,blowfish-cbc,cast128-cbc,aes192-cbc,aes256-cbc,arcfour,rijndael-cbc@lysator.liu.se debug2: macs ctos: hmac-md5-etm@openssh.com,hmac-sha1-etm@openssh.com,umac-64-etm@openssh.com,umac-128-etm@openssh.com,hmac-sha2-256-etm@openssh.com,hmac-sha2-512-etm@openssh.com,hmac-ripemd160-etm@openssh.com,hmac-sha1-96-etm@openssh.com,hmac-md5-96-etm@openssh.com,hmac-md5,hmac-sha1,umac-64@openssh.com,umac-128@openssh.com,hmac-sha2-256,hmac-sha2-512,hmac-ripemd160,hmac-ripemd160@openssh.com,hmac-sha1-96,hmac-md5-96 debug2: macs stoc: hmac-md5-etm@openssh.com,hmac-sha1-etm@openssh.com,umac-64-etm@openssh.com,umac-128-etm@openssh.com,hmac-sha2-256-etm@openssh.com,hmac-sha2-512-etm@openssh.com,hmac-ripemd160-etm@openssh.com,hmac-sha1-96-etm@openssh.com,hmac-md5-96-etm@openssh.com,hmac-md5,hmac-sha1,umac-64@openssh.com,umac-128@openssh.com,hmac-sha2-256,hmac-sha2-512,hmac-ripemd160,hmac-ripemd160@openssh.com,hmac-sha1-96,hmac-md5-96 debug2: compression ctos: none,zlib@openssh.com debug2: compression stoc: none,zlib@openssh.com debug2: languages ctos: debug2: languages stoc: debug2: first_kex_follows 0 debug2: reserved 0 debug1: kex: algorithm: curve25519-sha256@libssh.org debug1: kex: host key algorithm: ecdsa-sha2-nistp256 debug1: kex: server->client cipher: chacha20-poly1305@openssh.com mac: <implicit> compression: none debug1: kex: client->server cipher: chacha20-poly1305@openssh.com mac: <implicit> compression: none debug3: send packet: type 30 debug1: expecting ssh2_msg_kex_ecdh_reply debug3: receive packet: type 31 debug1: server host key: debug3: hostkeys_foreach: reading file "/home/tim/.ssh/known_hosts" debug3: record_hostkey: found key type ecdsa in file /home/tim/.ssh/known_hosts:3 debug3: load_hostkeys: loaded 1 keys from 10.0.12.28 debug1: host '10.0.12.28' is known and matches the ecdsa host key. debug1: found key in /home/tim/.ssh/known_hosts:3 debug3: send packet: type 21 debug2: set_newkeys: mode 1 debug1: rekey after 134217728 blocks debug1: ssh2_msg_newkeys sent debug1: expecting ssh2_msg_newkeys debug3: receive packet: type 21 debug2: set_newkeys: mode 0 debug1: rekey after 134217728 blocks debug1: ssh2_msg_newkeys received debug2: key: /home/tim/.ssh/id_rsa (0x55ee619ab2b0), explicit, agent debug2: key: /home/tim/.ssh/id_rsa (0x55ee619bcfa0), agent debug2: key: tim@tim-ux31a-debian (0x55ee619b9370), agent debug3: send packet: type 5 debug3: receive packet: type 6 debug2: service_accept: ssh-userauth debug1: ssh2_msg_service_accept received debug3: send packet: type 50 debug3: receive packet: type 51 debug1: authentications that can continue: publickey,gssapi-keyex,gssapi-with-mic,password debug3: start over, passed a different list publickey,gssapi-keyex,gssapi-with-mic,password debug3: preferred gssapi-keyex,gssapi-with-mic,publickey,keyboard-interactive debug3: authmethod_lookup gssapi-keyex debug3: remaining preferred: gssapi-with-mic,publickey,keyboard-interactive debug3: authmethod_is_enabled gssapi-keyex debug1: next authentication method: gssapi-keyex debug1: no valid key exchange context debug2: we did not send a packet, disable method debug3: authmethod_lookup gssapi-with-mic debug3: remaining preferred: publickey,keyboard-interactive debug3: authmethod_is_enabled gssapi-with-mic debug1: next authentication method: gssapi-with-mic debug1: unspecified gss failure. minor code may provide more information no kerberos credentials available debug1: unspecified gss failure. minor code may provide more information no kerberos credentials available debug1: unspecified gss failure. minor code may provide more information debug1: unspecified gss failure. minor code may provide more information no kerberos credentials available debug2: we did not send a packet, disable method debug3: authmethod_lookup publickey debug3: remaining preferred: keyboard-interactive debug3: authmethod_is_enabled publickey debug1: next authentication method: publickey debug1: offering rsa public key: /home/tim/.ssh/id_rsa debug3: send_pubkey_test debug3: send packet: type 50 debug2: we sent a publickey packet, wait for reply debug3: receive packet: type 51 debug1: authentications that can continue: publickey,gssapi-keyex,gssapi-with-mic,password debug1: offering rsa public key: /home/tim/.ssh/id_rsa debug3: send_pubkey_test debug3: send packet: type 50 debug2: we sent a publickey packet, wait for reply debug3: receive packet: type 51 debug1: authentications that can continue: publickey,gssapi-keyex,gssapi-with-mic,password debug1: offering rsa public key: tim@tim-ux31a-debian debug3: send_pubkey_test debug3: send packet: type 50 debug2: we sent a publickey packet, wait for reply debug3: receive packet: type 51 debug1: authentications that can continue: publickey,gssapi-keyex,gssapi-with-mic,password debug2: we did not send a packet, disable method debug1: no more authentication methods to try. permission denied (publickey,gssapi-keyex,gssapi-with-mic,password).
回答: .sshフォルダのアクセス許可が正しくコピー&ペーストされていないようです。もう一度追加してもらえますか。厳密モードが有効になっている場合は、.sshに正しいパーミッションがあることを確認する必要があります。 .ssh/はpermを持つべきです0700/rwx------ .ssh/*.pubファイルは644/rw-r--r--であるべきです .ssh/*(.ssh内の他のファイル)0600/rw------- パーミッション的に物事はどのようにあなたのために見えますか?