For some reason I want to run a script to move files from Linux machine to Windows. I have installed cwRsync on my windows machine and able to connect to linux machine.

When i execute following command:

rsync -e "ssh -l "piyush"" -Wgovz --timeout 120 --delay-updates --remove-sent-files /usr/local/src/piyush/sync/* "piyush@"

Where is my widows machine and I am running above command on Linux - CentOS 5.5.

After running command I get following error message:

ssh: connect to host port 22: Connection refused
rsync: connection unexpectedly closed (0 bytes received so far) [sender]
rsync error: error in rsync protocol data stream (code 12) at io.c(463) [sender=2.6.8]
[root@localhost sync]# ssh uniken@
ssh: connect to host port 22: Connection refused

I have modified my firewall settings on widows to allow all ports. I think this issue is due to SSH Daemon not present on my windows machine. So I tried installing OpenSSH on my machine and running ssh-agent but didn't helped.

I tried similar command to run on my widows machine to pull files from Linux and its working fine. For some reason I want command for Linux machine so that I can embed it in a shell script.

Can you suggest me if I am missing anything.

I am already having cwRsync installed on my widows and running it in daemon mode using --damemon option. And I am able to login using ssh from windows machine to linux machine.

When I issue bellow command, it just blocks for 120 seconds (timeout I specified in command) and exits saying there is timeout.

rsync -e "ssh -l piyush" -Wgovz --timeout 120 --delay-updates --remove-sent-files /usr/local/src/piyush/sync/* "piyush@"

After starting rsync on widows, I checked, rsyc is running. And widows firewall setting are set to minimal, and on Linux machine stopped iptables service so that port 873 (default rsync port) is not blocked.

What can be the possible reason that Linux machine is not able to connect to rsync-daemon on windows machine?

  • //am able to login using ssh from windows machine to linux machine. You should try the reverse. login to windows machine from linux to make sure you have ssh daemon running on windows. – Nandhini Anand Jeyahar Jun 27 '11 at 5:56
  • I tried that also and SSH is working fine both ways. Note: I am using Windows 7 and Linux Centos 5.5 – user85785 Jun 27 '11 at 9:14
  • I even tried by omitting ssh as suggested bellow by 3molo, but still its not working. It asks for password to authenticate and then just blocks. In cwrsyn log I can see that rsync has started listening on port 873. – user85785 Jun 27 '11 at 9:18

Piyush, rsync in daemon mode supports connectivity over the rsync protocol, rather than only over ssh protocol.


rsync -e "ssh -l piyush" -Wgovz --timeout 120 --delay-updates --remove-sent-files /usr/local/src/piyush/sync/* "piyush@"


rsync -Wgovz --timeout 120 --delay-updates --remove-sent-files /usr/local/src/piyush/sync/* rsync://piyush@


Rsync normally uses ssh for communication. It requires no special privileges for installation. You must, however, have a working ssh system.

I assume you don't have it. I can recommend cygwin (do ssh-host-config after installation). However, this is frequently not (perceived as) easy.

You can also opt to use rsync daemon.

  1. write an rsyncd.conf
  2. run rsync daemon (consult cwRsync documentation, or just manually start rsync --daemon for now) on the windows machine
  3. instead of piyush@ use e.g. piyush@

some background: http://www.itefix.no/i2/node/10650

  • "Alternatively, rsync can run in `daemon' mode, listening on a socket. This is generally used for public file distribution, although authentication and access control are available. Cygwin is a Linux-like environment for Windows. It consists of a DLL (cygwin1.dll), which emulates substantial Linux API functionality, and a collection of tools." // itefix.no/i2/node/10650 – 3molo Jun 27 '11 at 6:31

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy