Multiple-Hop SCP

This took me a while to find, so I thought I’d blog it in case future generations are searching, or anyone can tell me a simpler way.

How To SCP Via A Gateway

$ # From localhost to remotehost...
$ scp -Cp -o "ProxyCommand ssh gatewayuser@gateway nc remotehost 22" file remoteuser@remotehost:/some/where/file

$ # ...and back again.
$ scp -Cp -o "ProxyCommand ssh gatewayuser@gateway nc remotehost 22" remoteuser@remotehost:/some/where/file file_copy

Hi Kris,

thank you very much – I knew this had to be possible, and I’m very happy that I didn’t have to find out the syntax myself.

As always, quite impressive what you can do on the bash…this is the real voodoo stuff.

You made my evening…

Cheers,
Philipp

Submitted by Philipp (not verified) on Tue, 2009-08-04 01:15.

Hi, You are a life saver. Thanks.

Best Regards,
arun

Submitted by kumarm_arun (not verified) on Thu, 2009-10-22 01:30.

Man, you are a genius!!!
I’ve been looking for the codeline for weeks!
THANK YOU.

Submitted by Hizki (not verified) on Tue, 2009-12-15 13:58.

Post new comment

The content of this field is kept private and will not be shown publicly.
  • Allowed HTML tags: <a> <em> <strong> <cite> <code> <ul> <ol> <li> <dl> <dt> <dd> <b> <i> <blockquote> <img>
  • You can use Textile markup to format text.
  • Textual smileys will be replaced with graphical ones.

More information about formatting options

CAPTCHA
Please answer this simple question - it's here to separate the real commentors from the spammers.
Image CAPTCHA
Copy the characters (respecting upper/lower case) from the image.