Transfer file from remote machine to local machine

Yubin Ruan ablacktshirt at gmail.com
Tue Jul 18 10:17:12 UTC 2017


On Mon, Jul 17, 2017 at 04:21:02PM +1000, Karl Auer wrote:
> On Mon, 2017-07-17 at 00:15 +0800, Yubin Ruan wrote:
> > I got a remote machine A and a remote machine B. Usually I log into
> > remote machine A using ssh and then use A as a relay to log into
> > remote machine B. But when I am in B, I don't know how to copy file
> > directly from B to my local machine.
> 
> You need a tunnel!
> 
> Assuming that:
> a) you can ssh from your system to machine A
> b) you can ssh from machine A to machine B
> c) you have credentials for machine B
> 
> ... then you can set up a tunnel.
> 
> On your system:
> 
>    ssh -L 2222:localhost:2222 youA at machineA
> 
> On A:
>    ssh -f -N -L 2222:localhost:22 youB at machineB
> 
> On your system:
> 
>    scp -p 2222 youB at localhost:/path/on/B/file.dat .

This seems perfect and I agree with your suggestion. But, unfortunately, as
remoteA is used as a relay, tunneling is block on remoteA. I just cannot
create a tunnel to remoteB on remoteA.

Transfering through the `sz' or `rz' is plausible, though. But I cannot get
around the terminal issue ...

Thanks,
Yubin




More information about the ubuntu-users mailing list