Unix & Linux Stack Exchange is a question and answer site for users of Linux, FreeBSD and other Un*x-like operating systems. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I have the following setup: Machines A, B , C running linux. I have to do a continuous rsync from machine A to machine C and have a script for that. However, the access to machine C from machine A is only through B. So I have to ssh into B and then I can ssh into C.

The way to rsync that I have now is that first I rsync from C to B and then rsync from B to A. However, with the additional copy between the machines, this is

share|improve this question
"With the additional copy between the machines, this is..." This is what? I think I know what you're trying to ask, but please finish your question... – Shadur Mar 27 '13 at 7:59

You can use netcat for this. Here's an example setup:

On machine A, your ~/.ssh/config looks like this:

Host            machinec.whatever.domain.com
ProxyCommand    /usr/bin/ssh machineb /usr/bin/nc %h %p

(with any addition of IdentityFile or anything else that you may require)

This will let you rsync straight through machine B; netcat/nc will forward the entire data stream for you. Of course, this requires that nc be available in that path on machine B.

share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.