LinuxQuestions.org
Visit Jeremy's Blog.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Networking
User Name
Password
Linux - Networking This forum is for any issue related to networks or networking.
Routing, network cards, OSI, etc. Anything is fair game.

Notices

Reply
 
Search this Thread
Old 12-21-2004, 10:12 PM   #1
shawn_t
LQ Newbie
 
Registered: Feb 2004
Posts: 13

Rep: Reputation: 0
rsync thru SSH --- connection unexpectedly closed


I am trying to use rsync to synchronize a remote folder through SSH.

I have a cygwin version of rsync installed on my Windows 2000 PC where:
Quote:
rsync --version displays: rsync version 2.4.6 protocol version 24
On my linux box, the version of rsync installed where:
Quote:
rsync --version displays: rsync version 2.5.7 protocol version 26
I have confirmed that I can login through ssh using the following command:

Quote:
ssh2 myuser@myserver.com echo hello
displays:
Authentication successful.
hello
I then try an rsync command such as:

Quote:
rsync -e ssh2 -avvvz --delete-after /someDir myuser@myserver.com:/someDir
This is where I get the following errors:
Quote:
rsync: connection unexpectedly closed (0 bytes read so far)
rsync error: error in rsync protocol data stream (code 12) at io.c(165)
read error: Connection reset by peer
I am wondering what might be the problem? Nothing appears in the logs except for an ssh session open followed by an ssh session close for myuser which seems to make sense.

Perhaps the different protocol versions are giving me problems?!?

Lastly, do I have to have rsync running on the server in --daemon mode for remote rsync to work? In the above example, I am not specifying a share name, but instead a remote directory so I was under the impression that running a remote daemon may not be necessary...

I have also tried starting rsync --daemon on the server with the following rsyncd.conf file:
Code:
#/etc/rsyncd.conf
motd file = /etc/rsyncd/rsyncd.motd
log file = /var/log/rsyncd.log
list = yes
uid = nobody
gid = nobody

[myshare]
        auth users = myuser
        hosts allow = *
        comment = My Comment for My Friends
        path = /someDir
        read only = no
        list = false
        secrets file = /etc/rsyncd/rsyncd.secrets
and then use an rsync command that references the share instead:
Quote:
rsync -e ssh2 -avvvz --delete-after /someDir myuser@myserver.com:myshare/someDir
and I get the same errors...
 
Old 12-21-2004, 10:54 PM   #2
homey
Senior Member
 
Registered: Oct 2003
Posts: 3,057

Rep: Reputation: 56
Quote:
do I have to have rsync running on the server in --daemon mode for remote rsync to work?
I don't use --daemon mode and it works ok for me.
Quote:
rsync -e ssh2 -avvvz --delete-after /someDir myuser@myserver.com:myshare/someDir
This is the command I use ...
Code:
rsync -e ssh -avz --delete-after /mnt/win/tech fred@mudd:/mnt/win
where /mnt/win/tech is on the local machine and fred@mudd:/mnt/win is on the remote box
 
Old 12-22-2004, 02:12 PM   #3
shawn_t
LQ Newbie
 
Registered: Feb 2004
Posts: 13

Original Poster
Rep: Reputation: 0
I tried your command and I still get the exact same error. Here is an example where I increased the verbosity:
Code:
$ rsync -e ssh2 -avvvz /cygdrive/C/myDir myuser@myserver.com:/myDir

opening connection using ssh2 -l myuser myserver.com rsync --server -vvvlogD
tprz . /myDir
rsync: connection unexpectedly closed (0 bytes read so far)
rsync error: error in rsync protocol data stream (code 12) at io.c(165)
_exit_cleanup(code=12, file=io.c, line=165): about to call exit(12)
rsync: read error: Connection reset by peer (104)
rsync error: error in rsync protocol data stream (code 12) at /home/lapo/packagi
ng/tmp/rsync-2.6.3/io.c(515)
_exit_cleanup(code=12, file=/home/lapo/packaging/tmp/rsync-2.6.3/io.c, line=515)
: about to call exit(12)
Checking the rsync documentation, code 12 seems to be RERR_STREAMIO so perhaps the problem is that I have different versions of rsync running on different machines. I have grabbed the latest cygwin version of rsync and it is now:

Quote:
rsync version 2.6.3 protocol version 28
which is now higher then my linux box. I guess I'll have to upgrade my linux box version and try again...
 
Old 12-22-2004, 02:42 PM   #4
shawn_t
LQ Newbie
 
Registered: Feb 2004
Posts: 13

Original Poster
Rep: Reputation: 0
I have updated my linux box to the same version and I still have the same problem. I can launch rsync remotely by issueing the command:
Code:
# ssh2 -l staras staras.myvnc.com rsync --daemon
Authentication successful.
@RSYNCD: 28
which seems to work properly and I can see the running process on my server.

Anyone have any suggestions on how to debug this problem further?
Any rules on permissions between folders on the local and remote box?
 
Old 02-25-2005, 02:27 PM   #5
billw1955
LQ Newbie
 
Registered: Feb 2005
Posts: 2

Rep: Reputation: 0
In my case, it turns out that the path I get on the remote machine using ssh for remote execution doesn't include rsync, i.e. I get different values of $PATH between "ssh me@remote 'echo $PATH'" and just ssh and then echo once I'm logged in.

lookup --rsync-path in rsync man.

Last edited by billw1955; 02-25-2005 at 02:34 PM.
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Can't SSH to remote machine: Connection closed by remote host Avatar Linux - Networking 34 05-24-2013 09:28 AM
SSH issue ""Server unexpectedly closed network connection" Errsta_Fonzarelli Linux - Software 12 05-24-2010 02:35 PM
SSH connection closed after username matcal Linux - Security 4 10-24-2005 11:04 AM
Rsync over Current SSH Connection tracer Linux - General 1 09-23-2005 07:39 AM
ssh connection closed by server m_yates Linux - Security 3 08-10-2005 03:12 PM


All times are GMT -5. The time now is 05:40 AM.

Main Menu
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
identi.ca: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration