異なる公開鍵を使用してサーバー間のscpを実行するには?

異なる公開鍵を使用してサーバー間のscpを実行するには?

scp両方のサーバーに異なるSSHキーが必要な場合は、サーバーを複製するためにサーバーのコマンドにどのパラメータを使用する必要がありますか?私はPC(私がコマンドを出すPC)scpからデータストリーミングなしであるサーバーから別のサーバーにファイルを転送する方法を知っています。

に基づいてこのチュートリアル、私の起動コマンドは次のとおりです。

scp -r [email protected]:/home/miguel/ [email protected]:/home/miguel/

ベストアンサー1

使用SSHエージェントそしてSSHを追加必要なすべての鍵。

例:

# start the agent and capture its environment in the current shell
eval `ssh-agent`

# add keys needed to connect to the different accounts
ssh-add /path/to/first/ssh/key
ssh-add /path/to/second/ssh/key

# do the copying
scp [email protected]:file1 [email protected]:file2

おすすめ記事