Straight rsync with intermediate SSH host
I assume the rsync (Deltacopy) server on C listens on the TCP port 873 and you can reach it from B. If so, this becomes the general problem of reaching a TCP port of C from A, when A cannot reach C directly, but can ssh
to B which can reach C.
Use local port forwarding:
# on A
ssh -NL 8873:C_seen_from_B:873 userB@B_seen_from_A
Here 8873
is the local port number, quite arbitrary; ssh
will listen on this port. I did not use 873
for two reasons:
- there may be a local rsync server that has already taken the port;
- you most likely are not allowed to use a port with number lower than 1024 anyway.
Now if you connect from A to localhost:8873
then you will reach the port 873 of C. C will see traffic coming in from B. So far there is nothing specific to rsync.
Next invoke rsync
on A and wherever in the command you need to specify a LOCATION
on C, use the syntax rsync://[USER@]HOST[:PORT]/LOCATION
(see "access via rsync daemon" in man 1 rsync
), where HOST
is localhost
and PORT
is 8873
.
E.g. if on B you would use rsync://C_seen_from_B:873/foo/bar
, now on A you should use rsync://localhost:8873/foo/bar
.
This way rsync
on A will connect to localhost:8873
of A where ssh
listens. The connection will be tunneled via SSH and the SSH server on B will connect to C_seen_from_B:873
for you. Ultimately the rsync
invoked on A will talk to the rsync (Deltacopy) server running on C.