A -G-> R

Run scp to machine R, which is only accessible through gateway machine G.

Set up SSH tunnel:

ssh -L 1234:<address of R known to G>:22 <user at G>@<address of G> 

Adding “cat -“ will keep it running while above will get you connected to G

$ ssh -L 1234:<address of R known to G>:22 @<address of G> cat -

Either way you run it, open another terminal for next step.

Step 2: Run scp against port 1234 pretending 127.0.0.1 (localhost) is the remote machine R, and the command will be sent to R.

$ scp -P 1234 @127.0.0.1:/path/to/file file-name-to-be-copied