私は何時間もこの問題に苦しんでいたので、助けてくれてありがとう。
私は2つのサーバーを持っていて、ssh
OSXの公開鍵を使って問題なく両方のサーバーに接続できるので確信していますsshd_config
。
両方のサーバーを同期するようにcronジョブを設定しようとしていますが、公開鍵を使用してサーバーB(バックアップ)をサーバーAに接続する必要がありrsync
ます。ssh
私の公開鍵が見つからない理由は一生不明です。公開鍵には場所があり~/.ssh/
(たとえば/root/.ssh
)、AとBに対するすべてのファイル権限が正しいです。
出力は次のとおりです。
debug2: we did not send a packet, disable method
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: Trying private key: /root/.ssh/id_rsa
debug3: no such identity: /root/.ssh/id_rsa
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
また、存在しない秘密鍵を探していることに注意してください。
drwx------. 2 root root 4096 May 25 10:15 .
dr-xr-x---. 4 root root 4096 May 24 18:52 ..
-rw-------. 1 root root 403 May 25 01:37 authorized_keys
-rw-------. 1 root root 0 May 25 01:41 config
-rw-------. 1 root root 1675 May 25 02:35 id_rsa_tm1
-rw-------. 1 root root 405 May 25 02:35 id_rsa_tm1.pub
-rw-------. 1 root root 395 May 25 02:36 known_hosts
ベストアンサー1
宛先ホストの無効なAuthorized_keysファイルは、sshが「私たちはパケットを送信していません」というメッセージを出力し、pubkey認証を使用する代わりにパスワードを要求するもう1つの理由です。
debug1: Next authentication method: publickey
debug1: Offering RSA public key: ~/.ssh/id_rsa
debug3: send_pubkey_test
debug2: we sent a publickey packet, wait for reply
debug1: Authentications that can continue: publickey,password
debug2: we did not send a packet, disable method
この特別なケースの問題は、.ssh/authorized_keys
ターゲットホストに貼り付けられた公開鍵データに最初の文字が欠落していることです。
sh-rsa AAAA...
解決策は簡単です。不足している「s」を追加することです。
ssh-rsa AAAA...
だから:-
debug1: Next authentication method: publickey
debug1: Offering RSA public key: ~/.ssh/id_rsa
debug3: send_pubkey_test
debug2: we sent a publickey packet, wait for reply
debug1: Server accepts key: pkalg ssh-rsa blen 279
...
debug1: Authentication succeeded (publickey).