I need to copy files with scp from host A to host D, where D is reachable only via host C. This is normally done by using a proxy:
ProxyCommand ssh -W %h:%p C
Now, due to some network issue, the copy is very slow (about 100 KB/s). However, I can copy files from host A to some other host B and from host B to host D (via C) both at a reasonable speed (more than 10 MB/s). The issue is that host B has little free space on the disk. So I need to instruct scp that on B, data need to be sent immediately to D (via C) instead of being stored on B.
I thought that a ProxyJump would be the solution, e.g.
scp -J B,C file D:
but this doesn't solve the slowness issue, which is still 100 KB/s.
What is the correct method?
Note: As a workaround, I can type on host B:
scp -3 A:file D:
(where a ProxyCommand is used in the ssh configuration for host D as mentioned above), and the file transfer is fast. So I would like some equivalent for a scp command typed on host A.