Reputation: 118
I have access to two remote systems via SSH authorized keys and I want to transfer files directly between them. Ideally with rsync. Password authentication is disabled on both remote systems, using my local SSH key is the only way I can log in.
I wonder if there is a way to initiate an rsync-transfer from one remote host to the other one using SSH auth forwarding?
I catch myself using workarounds every so often to achieve this:
All workarounds mentioned above are somehow fiddly and / or slow.
What is the best option?
Upvotes: 2
Views: 722
Reputation: 118
I figured out that this is pretty easy to achieve using ssh-agent.
Just for reference:
local> eval $(ssh-agent) #Start ssh-agent
local> ssh-add <private_key> #for example .ssh/id_rsa
local> ssh -A public-host-a #-A enables ssh agent forwarding
public-host-a> rsync -av /data public-host-b:/data
Using ssh agent forwarding, it makes the remote system behave as if the private key from the local system has been copied over to the target system. It is also possible to checkout private git repositories directly from a remote system which seems quite handy to me.
Upvotes: 2