rsync over SSH from Windows to Linux : strange error. - Tools

This is a discussion on rsync over SSH from Windows to Linux : strange error. - Tools ; Hi ! This is a classical use : i'm trying to backup a Win2K client onto a Linux Debian server. I chose to do it with rsync through SSH. Right now, all the pieces (rsync and ssh) are working perfectly ...

+ Reply to Thread
Results 1 to 3 of 3

Thread: rsync over SSH from Windows to Linux : strange error.

  1. rsync over SSH from Windows to Linux : strange error.

    Hi !

    This is a classical use : i'm trying to backup a Win2K client onto a
    Linux Debian server. I chose to do it with rsync through SSH. Right
    now, all the pieces (rsync and ssh) are working perfectly when used
    separatly, but I can't get rsync to actually work when called with the
    --rsh= option.

    Here is what I have :

    - SSH2 server is set up on the Linux server & SSH2 clients (both win32
    and command-line) are on the Windows machine. SSH is working
    perfectly, and I can log manually onto the Linux server from Windows
    in command-line using public key authentification (so no password is
    asked). I'm using old ssh2.com's tools v2.40 for this evaluation.

    - rsync 2.6.0-2 (Debian) is installed on the Linux server, and has a
    single module called "backup" defined in rsynd.conf. On the Windows
    machine, I'm using a partial Cygwin install (cygwin1.dll 1.5.7 and
    cygpopt-0.dll) with the rsync.exe binary (2.6.0) in the same
    directory.
    rsync seems to be working all right by itself : if I start a rsync
    *server* on the Linux server I can then manually use rsync on Windows
    as a client to do actually do syncs. This works fine.

    My problem is when I try to automate this.

    Doing (on Windows) rsync -vvv -rsh="ssh2 -p 2222 -x -l backup" foo:
    (to list the module on the Linux server) yelds a :

    cmd=ssh2 -p 2222 -x -l backup machine=foo user=backup path=
    cmd=ssh2 -p 2222 -x -l backup -l backup foo rsync --server --sender
    -vvvvr .
    opening connection using ssh2 -p 2222 -x -l backup -l backup foo rsync
    --server --sender -vvvvr .
    _exit_cleanup(code=12, file=/home/lapo/packaging/tmp/rsync-2.6.0/io.c,
    line=189): entered
    _exit_cleanup(code=12, file=/home/lapo/packaging/tmp/rsync-2.6.0/io.c,
    line=189): about to call exit(12)

    rsync: connection unexpectedly closed (0 bytes read so far)
    rsync error: error in rsync protocol data stream (code 12) at
    /home/lapo/packagi
    ng/tmp/rsync-2.6.0/io.c(189)

    Notes :

    - both path are setup. On the server, rsync is in /usr/bin which is
    accessible to the backup user. On Windows, I'm running the command
    from the directory where rsync & cygwin sit.

    - user "backup" has read/write/execute permission in the path defined
    for rsync's module.

    - the rsync's PID file is in a writeable dir for user backup.

    I did my homework, read man pages, tutorials, scoured the web & news
    for answers, but found none. Most of the problems I read about this
    "rsync protocol data stream (code 12)" error where related to the
    shell being unable to find rsync on the remote machine, which is not
    the problem here. I even don't get an error from rsync before it's
    being disconnected.

    I'm sure I'm missing something obvious, like a parameter or
    something... but can't get to it. Anyone would have an idea ?

    Full strace log on the windows side is available if needed .

    Thanks !

    l.

  2. Re: rsync over SSH from Windows to Linux : strange error.

    I too have had similar errors trying to get SSH2 working with a few
    versions of rsync/cygwin.

    I have tried windows rsync upto version 2.6.0 protocol version 27,
    and corresponding cygwin/cygpopt-0

    I also experienced the same errors with rsync v 2.4.6, 2.5.5 & related
    cygwin bits.

    I am using SSH.com's ssh2.exe (non-commercial) SSH Secure Shell 3.2.9
    Windows Client.

    SSH2 by itself works fine, I can connect to the RH8.0 box with public
    key auth (as I also can with SSH1).

    I can do an rsync -e ssh -avzp source dest OK, but that's using SSH1
    which ettercap nicely unsecures, and as I would like to do this rsync
    via internet, I'd rather it be slightly more secure...

    So, here's a dump for anyone who can possibly shed some light?! I did
    read the io.c source and in there it specifically mentions issues with
    rsync <2.4.6 causing an invalid exit, but assuming post 2.4.6 should
    all be OK. As can be seen, SSH2 _does_ connect OK, but handing to
    rsync for the transport fails.

    rsync -e "ssh2 -v -l root" -avzp "/cygdrive/c/rsync3"
    "192.168.3.1:/me/backup"
    debug: Ssh2: License file not found, certificates & smart cards
    disabled.
    debug: Ssh2: User config file not found, using defaults. (Looked for
    'C:/Docum
    ts and Settings/Administrator/Application Data/SSH/ssh2_config')
    debug: Connecting to 192.168.3.1, port 22... (SOCKS not used)
    debug: Ssh2Transport: My version: SSH-1.99-3.2.9 SSH Secure Shell
    Windows Clie

    debug: client supports 2 auth methods: 'publickey,password'
    debug: Ssh2Common: local ip = 192.168.1.10, local port = 3415
    debug: Ssh2Common: remote ip = 192.168.3.1, remote port = 22
    debug: SshConnection: Wrapping...
    debug: Remote version: SSH-1.99-OpenSSH_3.4p1
    debug: OpenSSH: Major: 3 Minor: 4 Revision: 0
    debug: Ssh2Transport: All versions of OpenSSH handle kex guesses
    incorrectly.
    debug: Ssh2Transport: lang s to c: `', lang c to s: `'
    debug: Ssh2Transport: c_to_s: cipher aes128-cbc, mac hmac-sha1,
    compression no

    debug: Ssh2Transport: s_to_c: cipher aes128-cbc, mac hmac-sha1,
    compression no

    debug: Remote host key found from database.
    debug: Ssh2Common: Received SSH_CROSS_STARTUP packet from connection
    protocol.
    debug: Ssh2Common: Received SSH_CROSS_ALGORITHMS packet from
    connection protoc
    ..
    debug: server offers auth methods
    'publickey,password,keyboard-interactive'.
    debug: Ssh2AuthPubKeyClient: Starting pubkey auth...
    debug: Ssh2AuthPubKeyClient: Agent is not running.
    debug: Ssh2AuthPubKeyClient: Got 0 keys from the agent.
    debug: SshConfig: Unable to open C:/Documents and
    Settings/Administrator/Appli
    tion Data/SSH/identification
    debug: SshUnixUserFiles: Keys for login not specified in 'C:/Documents
    and Set
    ngs/Administrator/Application Data/SSH/identification', using all keys
    availab
    ..
    debug: Ssh2AuthPubKeyClient: adding keyfile "C:/Documents and
    Settings/Adminis
    ator/Application Data/SSH/userkeys/az" to candidates
    debug: Ssh2AuthPubKeyClient: Trying 1 key candidates.
    debug: Constructing and sending signature in publickey authentication.
    debug: Ssh2AuthPubKeyClient: reading private key C:/Documents and
    Settings/Adm
    istrator/Application Data/SSH/userkeys/az
    debug: Ssh2AuthPubKeyClient: Public key authentication was successful.
    debug: Ssh2Common: Received SSH_CROSS_AUTHENTICATED packet from
    connection pro
    col.
    debug: Ssh2Common: num_channels now 1
    debug: Ssh2ChannelSession: Requesting x11 forwarding
    debug: Ssh2ChannelSession: Requesting SSH2 agent forwarding
    debug: Ssh2ChannelSession: Requesting command rsync --server
    -vlogDtprz . /hom
    backup
    debug: SshConnection: EOF from channel stream
    rsync: connection unexpectedly closed (0 bytes read so far)
    rsync error: error in rsync protocol data stream (code 12) at
    io.c(150)
    debug: Ssh2ChannelSession: received exit status : 12
    debug: Ssh2Common: num_channels now 0
    debug: Got session close with exit_status=12
    debug: Ssh2Common: Destroying SshCommon object.
    debug: SshConnection: Destroying SshConn object.
    rsync: read error: Connection reset by peer
    rsync error: error in rsync protocol data stream (code 12) at
    /home/lapo/packa
    ng/tmp/rsync-2.6.0/io.c(201)



    laurent75@netcourrier.com (Laurent_wiz) wrote in message news:...
    > Hi !
    >
    > This is a classical use : i'm trying to backup a Win2K client onto a
    > Linux Debian server. I chose to do it with rsync through SSH. Right
    > now, all the pieces (rsync and ssh) are working perfectly when used
    > separatly, but I can't get rsync to actually work when called with the
    > --rsh= option.
    >
    > Here is what I have :
    >
    > - SSH2 server is set up on the Linux server & SSH2 clients (both win32
    > and command-line) are on the Windows machine. SSH is working
    > perfectly, and I can log manually onto the Linux server from Windows
    > in command-line using public key authentification (so no password is
    > asked). I'm using old ssh2.com's tools v2.40 for this evaluation.
    >
    > - rsync 2.6.0-2 (Debian) is installed on the Linux server, and has a
    > single module called "backup" defined in rsynd.conf. On the Windows
    > machine, I'm using a partial Cygwin install (cygwin1.dll 1.5.7 and
    > cygpopt-0.dll) with the rsync.exe binary (2.6.0) in the same
    > directory.
    > rsync seems to be working all right by itself : if I start a rsync
    > *server* on the Linux server I can then manually use rsync on Windows
    > as a client to do actually do syncs. This works fine.
    >
    > My problem is when I try to automate this.
    >
    > Doing (on Windows) rsync -vvv -rsh="ssh2 -p 2222 -x -l backup" foo:
    > (to list the module on the Linux server) yelds a :
    >
    > cmd=ssh2 -p 2222 -x -l backup machine=foo user=backup path=
    > cmd=ssh2 -p 2222 -x -l backup -l backup foo rsync --server --sender
    > -vvvvr .
    > opening connection using ssh2 -p 2222 -x -l backup -l backup foo rsync
    > --server --sender -vvvvr .
    > _exit_cleanup(code=12, file=/home/lapo/packaging/tmp/rsync-2.6.0/io.c,
    > line=189): entered
    > _exit_cleanup(code=12, file=/home/lapo/packaging/tmp/rsync-2.6.0/io.c,
    > line=189): about to call exit(12)
    >
    > rsync: connection unexpectedly closed (0 bytes read so far)
    > rsync error: error in rsync protocol data stream (code 12) at
    > /home/lapo/packagi
    > ng/tmp/rsync-2.6.0/io.c(189)
    >
    > Notes :
    >
    > - both path are setup. On the server, rsync is in /usr/bin which is
    > accessible to the backup user. On Windows, I'm running the command
    > from the directory where rsync & cygwin sit.
    >
    > - user "backup" has read/write/execute permission in the path defined
    > for rsync's module.
    >
    > - the rsync's PID file is in a writeable dir for user backup.
    >
    > I did my homework, read man pages, tutorials, scoured the web & news
    > for answers, but found none. Most of the problems I read about this
    > "rsync protocol data stream (code 12)" error where related to the
    > shell being unable to find rsync on the remote machine, which is not
    > the problem here. I even don't get an error from rsync before it's
    > being disconnected.
    >
    > I'm sure I'm missing something obvious, like a parameter or
    > something... but can't get to it. Anyone would have an idea ?
    >
    > Full strace log on the windows side is available if needed .
    >
    > Thanks !
    >
    > l.


  3. Re: rsync over SSH from Windows to Linux : strange error. SOLVED

    OK, after a bit (READ: waaay too long reading and googling...) of
    investigation, I've found a solution which works for me.

    Basically I tried everything I could think of to get the SSH2 client
    from SSH.com working with the rsync app, and nothing would work. So, I
    switched to using OpenSSH, and it works perfectly!

    I googled for openssh windows binaries (not being the type to buld my
    own...), and found version 3.7.1p1 avail
    (http://lexa.mckenna.edu/sshwindows/). It took some reading and
    messing about to get it to install and run as I wanted it to, but in
    the end, all worth it.

    I've now got a win client which can rsync using ssh2 to my linux box,
    and I am less concerned about MITMs from things like ettercap for now.

    Hope this helps,

    Adrian

+ Reply to Thread