6

I'd like to download a file from server C, through server B (bastion) to my local server A.

Normally I'd handle the mess in ssh/config with ProxyCommand, but in this case I can't. Can we make a one-liner with rsync which still would allow me to do the above?

1 Answer 1

6

This is quite the one-liner, but you can do the following:

 rsync -e 'ssh -o ProxyCommand="ssh -W %h:%p user@B"' user@C:file .
3
  • 2
    In newer versions of ssh, you can also use the -J ssh command-line argument to make a shorter and more readable command: rsync -e 'ssh -J user@B' user@C:file . Nov 19, 2019 at 6:24
  • @theferrit32 that's a proper answer on its own. If you make it an answer I'll accept it in favor of my own
    – hbogert
    Mar 16, 2021 at 13:50
  • o.c. I meant to say, "I'll unaccept my answer, in favor of your answer"
    – hbogert
    Aug 12, 2021 at 7:12

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .