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)?


1 Answer 1


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.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.