質問: sshは、公開鍵がインストールされている場合でもパスワードを要求します 重複の可能性: 共有sshキーの問題 2つのサーバー間で公開鍵認証を設定しました。すべてが機能するはずですが、それでもパスワードの入力を求められます。これが私のsshd設定ファイルの一部で、システムのセットアップ後に変更しませんでした。rsaauthentication yes pubkeyauthentication yes authorizedkeysfile %h/.ssh/authorized_keys 許可されたキーファイルが存在し、すべてが存在します。私は多くのマシンで公開鍵を使用してこの手順を実行してきましたが、そのような問題は発生しませんでした。あなたは何をすることを提案しますか?デバッグ出力は私に以下を与えます:debug1: identity file /root/.ssh/identity type -1 debug3: not a rsa1 key file /root/.ssh/id_rsa. debug2: key_type_from_name: unknown key type '-----begin' debug3: key_read: missing keytype debug3: key_read: missing whitespace debug3: key_read: missing whitespace ... debug2: key_type_from_name: unknown key type '-----end' debug3: key_read: missing keytype debug1: identity file /root/.ssh/id_rsa type 1 debug1: identity file /root/.ssh/id_dsa type -1 debug1: remote protocol version 2.0, remote software version openssh_5.1p1 debian-5 debug1: match: openssh_5.1p1 debian-5 pat openssh* debug1: enabling compatibility mode for protocol 2.0 debug1: local version string ssh-2.0-openssh_4.7p1 debian-8ubuntu1.2 debug2: fd 3 setting o_nonblock debug1: ssh2_msg_kexinit sent debug1: ssh2_msg_kexinit received debug2: kex_parse_kexinit: diffie-hellman-group-exchange-sha256,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-cbc,3des-cbc,blowfish-cbc,cast128-cbc,arcfour128,arcfour256,arcfour,aes192-cbc,aes256-cbc,rijndael-cbc@lysator.liu.se,aes128-ctr,aes192-ctr,aes256-ctr debug2: kex_parse_kexinit: aes128-cbc,3des-cbc,blowfish-cbc,cast128-cbc,arcfour128,arcfour256,arcfour,aes192-cbc,aes256-cbc,rijndael-cbc@lysator.liu.se,aes128-ctr,aes192-ctr,aes256-ctr debug2: kex_parse_kexinit: hmac-md5,hmac-sha1,umac-64@openssh.com,hmac-ripemd160,hmac-ripemd160@openssh.com,hmac-sha1-96,hmac-md5-96 debug2: kex_parse_kexinit: hmac-md5,hmac-sha1,umac-64@openssh.com,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: diffie-hellman-group-exchange-sha256,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-cbc,3des-cbc,blowfish-cbc,cast128-cbc,arcfour128,arcfour256,arcfour,aes192-cbc,aes256-cbc,rijndael-cbc@lysator.liu.se,aes128-ctr,aes192-ctr,aes256-ctr debug2: kex_parse_kexinit: aes128-cbc,3des-cbc,blowfish-cbc,cast128-cbc,arcfour128,arcfour256,arcfour,aes192-cbc,aes256-cbc,rijndael-cbc@lysator.liu.se,aes128-ctr,aes192-ctr,aes256-ctr debug2: kex_parse_kexinit: hmac-md5,hmac-sha1,umac-64@openssh.com,hmac-ripemd160,hmac-ripemd160@openssh.com,hmac-sha1-96,hmac-md5-96 debug2: kex_parse_kexinit: hmac-md5,hmac-sha1,umac-64@openssh.com,hmac-ripemd160,hmac-ripemd160@openssh.com,hmac-sha1-96,hmac-md5-96 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 debug2: mac_setup: found hmac-md5 debug1: kex: server->client aes128-cbc hmac-md5 none debug2: mac_setup: found hmac-md5 debug1: kex: client->server aes128-cbc 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: 126/256 debug2: bits set: 529/1024 debug1: ssh2_msg_kex_dh_gex_init sent debug1: expecting ssh2_msg_kex_dh_gex_reply debug3: check_host_in_hostfile: filename /root/.ssh/known_hosts debug3: check_host_in_hostfile: match line 4 debug1: host '...' is known and matches the rsa host key. debug1: found key in /root/.ssh/known_hosts:4 debug2: bits set: 481/1024 debug1: ssh_rsa_verify: signature correct debug2: kex_derive_keys 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: /root/.ssh/identity ((nil)) debug2: key: /root/.ssh/id_rsa (0xb7fef588) debug2: key: /root/.ssh/id_dsa ((nil)) debug1: authentications that can continue: publickey,password debug3: start over, passed a different list publickey,password debug3: preferred gssapi-keyex,gssapi-with-mic,gssapi,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: trying private key: /root/.ssh/identity debug3: no such identity: /root/.ssh/identity debug1: offering public key: /root/.ssh/id_rsa debug3: send_pubkey_test debug2: we sent a publickey packet, wait for reply debug1: authentications that can continue: publickey,password debug1: trying private key: /root/.ssh/id_dsa debug3: no such identity: /root/.ssh/id_dsa 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 編集:私の秘密鍵ファイルは次のようになります:-----begin rsa private key----- key goes here -----end rsa private key----- ssh-keygen -t rsaを使用して生成しました。私のクライアントとサーバーのバージョンは次のとおりです。openssh_4.7p1 debian-8ubuntu1.2, openssl 0.9.8g 19 oct 2007 (client) openssh_5.1p1 debian-5, openssl 0.9.8g 19 oct 2007 (server) これは、クライアントのディレクトリ構造です。root@xxx:~/.ssh# ls -lha total 20k drwx------ 2 root root 4.0k 2010-10-19 18:00 . drwxr-xr-x 8 root root 4.0k 2010-10-17 00:01 .. -rw------- 1 root root 1.7k 2010-10-19 18:51 id_rsa -rw-r--r-- 1 root root 393 2010-10-19 18:51 id_rsa.pub -rw-r--r-- 1 root root 1.6k 2010-10-19 18:02 known_hosts そしてこれはサーバー上にあります:...:/home/xxx/.ssh# ls -lha total 12k drwx------ 2 dreisadmin dreisadmin 4.0k 2010-10-19 18:07 . drwxrwxr-x 5 dreisadmin dreisadmin 4.0k 2010-10-19 18:58 .. -rw------- 1 dreisadmin dreisadmin 393 2010-10-19 19:33 authorized_keys
回答: identity file /root/.ssh/identity type -1 debug3: not a rsa1 key file /root/.ssh/id_rsa. debug2: key_type_from_name: unknown key type '-----begin' debug3: key_read: missing keytype debug3: key_read: missing whitespace debug3: key_read: missing whitespace キーファイルに問題があるようです。フォーマットを確認し、新しいフォーマットを生成する可能性があります(念のため古いフォーマットを保持してください)。編集:ここにいくつかの提案を含む同様のq: https://serverfault.com/questions/119881/ssh-exchange-identification-connection-closed-by-remote-host