SCP between two networks
Solution 1:
You should be able to use an SSH tunnel.
Assuming you're trying to transfer a file from a remote computer ("remote") to your local computer ("local"), establish the tunnel via the third computer ("gateway") by typing this on your local computer:
ssh -fNL 12345:remote:22 gatewaylogin@gateway
Then you can run an unlimited amount of SCP commands on this tunnel (still typing on your local computer):
scp -P 12345 remotelogin@localhost://path/to/remote/file /local/path/where/you/want/file
I just tested this on my network, and it worked perfectly.
The above method is fine if the remote network is secure, but if it is not secure, you'd need to establish a tunnel between local and gateway, and another tunnel between gateway and remote, linking the two by a common port number.
Solution 2:
The scp option -3 ought to be what you are looking for. To put it in your example:
scp -3 root@firstcomputer:./file root@secondcomputer:./
Note that the -3 option was first introduced in OpenSSH 5.7, which was released early 2011.
Solution 3:
You can try this:
root@firstcomputer:./file /tmp && scp /tmp/file root@secondcomputer:./ && rm /tmp/file
This will copy the file into the /tmp directory on the third computer and if it is successful, it will recopy that file to the secondary computer and then clean up itself. Since you are using the && operator, each command will only execute if the prior command is successful.