SCP establishes a new connection when copying files, which sometimes can make it hard if there are firewalls involved.
For example,
Host-A <--> Host-B <--> Host-C <--> Host-D
- Host-A is connected to Host-B via SSH, and then Host-B is connected to Host-C via SSH, and then to Host-D.
- Host-A cannot connect to other computers other than Host-B, Host-B can only connect to Host-A and Host-C, Host-C can only connect to Host-B and Host-D, and last Host-D can only connect to Host-C.
The command (on Host-D) scp /home/user/file Host-A:/home/user/newfile will attempt to create a new SSH tunnel between the two, which is not what i want. I want the existing SSH tunnel chain to copy the file back through the previous hosts until it reaches Host-A.
How can i do this?