2

The question describes how to SSH into a machine that can only be accessed through one or more hosts (that can also be SSH'd into).

Is there an equivalent way of using scp? That is, copy a file to my local machine from the far machine (assuming I have password or key access to all machines along the way)?

tonysdg
  • 123
  • The following explanation of how SCP works under the hood might be helpful: https://blogs.oracle.com/janp/entry/how_the_scp_protocol_works – phk Jul 15 '16 at 19:20

1 Answers1

6

It works the same way as the multi-hop ssh if you will use the ProxyCommand. The ProxyCommand is transparent regardless what you do above that.

Host proxy
  Hostname proxy.tld
  User proxy_user
Host target
  Hostname target.tld
  User target_user
  ProxyCommand ssh -W %h:%p proxy

Then running scp file target: will copy the file over the proxy to the target.

Jakuje
  • 21,357