osx - scp between two terminal windows (or multihop scp) -


i regularly have connect several systems via ssh using multiple hops. happens want copy file either destination system local system or other way around in simple way (my current work flow copy file external location both machines can see saves me few hops or if file not binary cat , copy/paste other terminal window). there easy way such thing?

i using osx , iterm2 (obviously woudn't mind changing latter).

so connection (local machine) -> (portal a) -> (machine b) -> (portal c) -> (machine d)

so copy files machine machine d in simple way (without copying file via hops or creating 4 tunnels).

it's not quite you're asking for, there tricks can play ssh proxying simplify sort of thing enormously. first thing familiar proxying multihop ssh connections on netcat. if have openssh version 5.4 or later on various hosts, add ~/.ssh/config:

host b     proxycommand ssh -w %h:%p  host c     proxycommand ssh b -w %h:%p  host d     proxycommand ssh d -w %h:%p 

if of intermediates don't have new enough version, have netcat (nc), can use instead:

host d     proxycommand ssh c nc %h %p 

this'll make ssh d automatically open tunnel c run connection over, automatically open tunnel b, ... you'll have authenticate 4 times (to a, b, etc) (unless have public-key authentication set up), other it's transparent. means can use sftp d, scp d:/path/to/file, etc.

now, there's 1 significant limitation on describe. can copy files e.g. d this:

scp a:/path/to/file d:/path/to/file 

...but file's contents travel path -> computer -> -> b -> c -> d. won't stored anywhere on path, if network link between , slow (e.g. you're working home), this'll bottleneck. in case, it'd best copy ~/.ssh/config entries c , d onto computer a, ssh normally, use scp /path/to/file d:/path/to/file , cut out hops.

btw, if want fancy, can add ~/.ssh/config:

host */*      proxycommand ssh $(dirname %h) -w $(basename %h):%p 

and use ssh a/b/c/d etc built tunnel path on spot. see the openssh cookbook details.


Comments

Popular posts from this blog

How has firefox/gecko HTML+CSS rendering changed in version 38? -

javascript - Complex json ng-repeat -

jquery - Cloning of rows and columns from the old table into the new with colSpan and rowSpan -