rsync behind a NAT

jw schultz jw at
Thu Oct 2 22:59:26 EST 2003

On Thu, Oct 02, 2003 at 02:12:22PM +0200, Olivier Kaloudoff wrote:
> Hi all,
> 	I'm trying to synchronise a whole directory
> tree using rsync, from a server named "dev", to the
> three servers named "w1, w2, w3", hidden behind the
> server named "prod".
> 	So I issued the following command, which
> failed:
> dev:~# rsync -avz -e 'ssh prod ssh w2' /users/prod/ root at prod:/home/
> bash: prod: command not found
> rsync: connection unexpectedly closed (0 bytes read so far)
> rsync error: error in rsync protocol data stream (code 12) at io.c(150)
> 	Are there any things that I'm missing ?
> the command 'ssh prod ssh w2' is not interpreted as a command,
> maybe I misunderstood the behavior of the -e option, or
> is it behaving badly ?

You are getting into some weird interactions with how ssh
parses its command line.  Add an extra -v and you will see.

It is possible in some cases to tweak the -e into a shape
that will do what you want.  Another possibility might be to
mess around with the --rsync-path option.

My preference would be to either configure the NAT box to
forward a set of high ports to 22 on w1, w2 and w3 or use
ssh to set up port forwarding and then connect over that.

For trying it out i'd suggest using rsync in list-only mode.

	J.W. Schultz            Pegasystems Technologies
	email address:		jw at

		Remember Cernan and Schmitt

More information about the rsync mailing list