Linux – Rsync Push files from linux to windoes. ssh issue – connection refused

linuxrsyncsftpshellssh

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@10.0.0.60:/cygdrive/d/temp"

Where 10.0.0.60 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 10.0.0.60 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@10.0.0.60
ssh: connect to host 10.0.0.60 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@10.0.0.60:/cygdrive/d/temp"

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?

Best Answer

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

Modify:

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

to:

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