Search code examples
sshscp

SCP: route from one box to another via box with permissions to both.


Suppose I have a terminal where I have access to box A and box B, and I need to copy content from box A to box B.

However, it is considered bad form for me to give log-in permissions to my user in box A to box B.

So, I need to run the following commands:

scp boxA:etc . 
scp etc boxB:.
rm etc

from my box with both permissions.

Is there a way, using scp, for me to bypass this intermediate write and just transmit through my root terminal from boxA to boxB?


Solution

  • Use the -3 flag:

         -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.  Note that this option disables
                 the progress meter.