As the title says, how can I download a file using scp over two hops? Preferably, the files must not be stored (written to disk) at any point in the first server, just transfered through.


Using simply :

scp user1@host1:/location/of/file user2@host2:/location/of/destination

If you have a traffic forwarder (netcat, socat, etc.):

scp -o ProxyCommand="ssh FIRST_HOP socat tcp:SECOND_HOP:22 stdio" \
        FIRST_HOP:/path/on/second_hop/file local/path/

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.