I am trying to copy files using rsync
from a server A, to a server C, through a bastion server B.
A -> B -> C
This can be achieved normally through using the -e
option, like: rsync -e 'ssh user@host' ...
. However, I can't figure out or find examples on how to do this when the server B has the key that server C is expecting. All search results assume server A has the key, and that key is on both B and C.
I can successfully use this ssh command to use the remote key:
ssh -t user@hostB ssh -i /home/user/.ssh/private_key user@hostC
But I am not able to translate this into a valid rsynd -e '...'
command. One main issue is that the above changes the ssh startup shell using -t
, which I don't think is the correct approach. I've also tried using the JumpHost ssh option:
rsync -e 'ssh -J user@hostB' ...
This is also unsuccessful.
While using rsync
is preferred, if this isn't possible then a solution that uses scp
will also be acceptable.