connection unexpectedly closed... solved

Nigel Gilbert n.gilbert at soc.surrey.ac.uk
Thu Jan 13 17:20:51 GMT 2005


I'm sorry about the rather confusing error report - I wanted to be 
brief and to the point, but ended up leaving out important detail.

I was running a script.  The missing "" were an artefact of me 
debugging the script by copy and pasting the rsync line as the argument 
to an echo command, and forgetting to escape the quote marks.  The 
actual rsync command as executed did have the quote marks in to make 
the -i and its argument part of the -e argument.

However, I found the answer to the problem.  The path to rsync on the 
server was not included in the remote shell's PATH shell variable, and 
so when ssh was invoked to run rsync as a remote command, it failed to 
find rsync.  This is why the script worked when the remote user was an 
ordinary user - for that user, rsync was in the its path, but not for 
root.

This might be thought to be a bug or a missing feature in rsync; rsync 
could have produced a more comprehensible error message.

Many thanks for your help, which encouraged me to go on looking!

Nigel



On 13 Jan 2005, at 10:53, John Van Essen wrote:

> On Wed, 12 Jan 2005, Nigel Gilbert <n.gilbert at soc.surrey.ac.uk> wrote:
>>
>> When I run
>>
>> rsync -v --exclude-from= -a --delete --numeric-ids -e ssh -i
>> /root/.ssh/id_rsa /bin/ root at sandi:/export/home/scbackup/socnt01//bin/
>
> Is this the *actual* command?
>
> - Why the null --exclude-from?
> - FYI - you have a double slash in the destination
> - Mainly - the -i and its argument need to be part of the -e argument:
>
>   rsync -v -a --delete --numeric-ids -e "ssh -i /root/.ssh/id_rsa" \
>   /bin/ root at sandi:/export/home/scbackup/socnt01/bin/
>
>> I immediately get:
>>
>> rsync: connection unexpectedly closed (0 bytes received so far) 
>> [sender]
>> rsync error: error in rsync protocol data stream (code 12) at 
>> io.c(359)
>> rsync -v --exclude-from= -a --delete -e ssh -i /root/.ssh/id_rsa 
>> /boot/
>> root at sandi:/export/home/scbackup/socnt01//boot/
>
> Why is this 'boot' and not 'bin' according to your rsync command?
> In any case, it's odd that this rsync command is being echoed back.
>
>> rsync: connection unexpectedly closed (0 bytes received so far) 
>> [sender]
>> rsync error: error in rsync protocol data stream (code 12) at 
>> io.c(359)
>>
>> However, if I run exactly the same command, but with a normal user as
>> the remote user instead of root, the rsync works as expected.
>
> I don't see how it can work at all with the ssh -i argument not 
> included
> in the -e argument string...
>
> Are you sure you have root access via ssh?  Some configs disable that.
>
> Lastly - what version of rsync are you using (always important to 
> know).
> -- 
>         John Van Essen  Univ of MN Alumnus  <vanes002 at umn.edu>
>
>



More information about the rsync mailing list