Ssh – scp between two servers not in the same network

routingscpsshvlan

There are two server that I can access with 2 different VPN connections. I have managed to have both VPN working on the same time on my machine (a bit of routing rules).

I want to do a scp <remote1>:some/file <remote2>:destination/folder from my laptop terminal. But when I try this, the scp command that is invoked on remote1 cannot find remote2 because they are not in the same network. Is it possible to force the scp command to pass through my laptop as a router?

If I try with Nautilus (connect to server, both servers, then copy-paste) it works, but I'd like to do it from a terminal.

Best Answer

Newer versions of scp have the option -3

-3

Copies between two remote hosts are transferred through the local host. Without this option the data is copied directly between the two remote hosts
Related Question