SSH 公開鍵がサーバーに送信されませんでした。

SSH 公開鍵がサーバーに送信されませんでした。

次の問題に苦労しています。 2つのサーバー間で同期するようにrsyncのcronジョブを設定しようとしています。これには、公開鍵を使用してサーバーBにSSH接続するためにサーバーA(ローカル)が必要です。

以前は、パスワードのない接続とパスワードのない接続を追加しました。

I. SSH経由でKey Agentを使用して無料でPassPhraseを設定する

  1. SSHキーエージェントの再起動
    1. ssh-agent -s 評価
  2. 秘密鍵の追加
    1. ssh - 追加 ~/.ssh/id_rsa_abc

デバッグ情報

debug1: SSH2_MSG_NEWKEYS sent 
debug1: expecting SSH2_MSG_NEWKEYS    
debug3: receive packet: type 21 
debug1: SSH2_MSG_NEWKEYS received    
debug2: set_newkeys: mode 0 
debug1: rekey after 4294967296 blocks    
debug2: key: /home/groups/user/.ssh/id_rsa_abc    (0x55ad08946370), explicit 
debug3: send packet: type 5 debug3:    receive packet: type 7 
debug1: SSH2_MSG_EXT_INFO received 
debug1:    kex_input_ext_info: server-sig-algs=<rsa-sha2-256,rsa-sha2-512>    
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 
debug3: start over, passed a different list    publickey 
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/groups/user/.ssh/id_rsa_abc   
debug3: send_pubkey_test debug3: send packet: type 50 
debug2: we sent    a publickey packet, wait for reply 
debug3: receive packet: type 60    
debug1: Server accepts key: pkalg rsa-sha2-512 blen 535 
debug2:    input_userauth_pk_ok: fp    SHA256:PYUC9QpfCGMZ8DOvOF944bFHchCNJyNRS2G+wjDXRKQ 
debug3:    sign_and_send_pubkey: RSA    SHA256:PYUC9QpfCGMZ8DOvOF944bFHchCNJyNRS2G+wjDXRKQ 
debug1:    read_passphrase: can't open /dev/tty: No such device or address    
debug2: no passphrase given, try next key 
debug2: we did not send a    packet, disable method 
debug1: No more authentication methods to try.    
Permission denied (publickey). ssh_exchange_identification:    
Connection closed by remote host ssh_exchange_identification:     
Connection closed by remote host 
rsync: connection unexpectedly    closed (0 bytes received so far) [sender] 
rsync error: unexplained    error (code 255) at io.c(226) [sender=3.1.2]

公開鍵は ~/.ssh/ (例: /root/.ssh) にあり、サーバー A と B に対するすべてのファイル権限が正確です。

rsyncコマンドをどのように実行しますか?

rsync -avP --stats --log-file=rsync.log -e 'ssh -p 22 -vvv' source_dir user@serverA:target_dir

ベストアンサー1

おすすめ記事