Strange SSH with rsync

Matt McCutchen hashproduct+rsync at gmail.com
Wed Feb 21 22:57:34 GMT 2007


On 2/21/07, Dave Markham <dave.markham at fjserv.net> wrote:
> Has anyone any idea why this wont work? Its in a script and im passing
> -e "${SSH}" to the Rsync command where :-
>
> SSH="$(/usr/bin/which ssh) -o ConnectTimeout=15 -o BatchMode=yes -n"

> rsync: connection unexpectedly closed (0 bytes read so far)
> rsync error: error in rsync protocol data stream (code 12) at io.c(165)
> rsync: connection unexpectedly closed (0 bytes received so far) [receiver]
> rsync error: error in rsync protocol data stream (code 12) at io.c(463)
> [receiver=2.6.8]

The -n option closes the half of the connection that sends data from
the local computer to the remote computer.  This messes rsync up
because rsync requires a connection that can send data both ways.  Get
rid of the -n.

Explanation of the error message: When the remote rsync tries to read
from the local rsync, it fails, writes the first "connection
unexpectedly closed", and quits.  That causes ssh to drop the entire
connection, so when the local rsync then tries to read from the remote
rsync, it fails and writes the second "connection unexpectedly closed"
message.

Matt


More information about the rsync mailing list