Rsync从Linux推送文件到windoes。 SSH问题 – 连接被拒绝

出于某种原因,我想运行一个脚本来将文件从Linux机器移动到Windows。 我已经在我的Windows机器上安装了cwRsync并且能够连接到linux机器。

当我执行以下命令:

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

10.0.0.60是我的widows机器,我正在Linux上执行命令 – CentOS 5.5。

运行命令后,我得到以下错误信息:

 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 [email protected] ssh: connect to host 10.0.0.60 port 22: Connection refused 

我已经修改了寡妇的防火墙设置,以允许所有的端口。 我认为这个问题是由于我的Windows机器上不存在SSH守护进程。 所以我尝试在我的机器上安装OpenSSH并运行ssh-agent,但没有帮助。

我尝试了类似的命令来运行我的widows机器从Linux中提取文件,并且工作正常。 出于某种原因,我想要Linux机器的命令,以便我可以将其embedded到shell脚本中。

如果我缺less任何东西,你能build议我吗?


我已经在我的widows上安装了cwRsync,并使用–damemon选项在守护进程模式下运行它。 我可以使用ssh从Windows机器login到Linux机器。

当我发出下面的命令,它只是阻塞了120秒(超时我在命令中指定),并退出说有超时。

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

在启动rsync之后,我检查了rsyc正在运行。 而寡妇的防火墙设置被设置为最小,并且在Linux机器上停止了iptables服务,以便端口873(默认rsync端口)不被阻塞。

Linux机器无法连接到Windows机器上的rsync-daemon可能是什么原因?

Piyush,守护进程模式下的rsync支持通过rsync协议进行连接,而不仅仅是通过ssh协议。

修改:

 rsync -e“ssh -l piyush”-Wgovz --timeout 120 --delay-updates --remove-sent-files / usr / local / src / piyush / sync / *“[email protected]:/ cygdrive / d / TEMP”

至:

 rsync -Wgovz --timeout 120 --delay-updates --remove-sent-files / usr / local / src / piyush / sync / * rsync://[email protected]:/ cygdrive / d / temp

cwRsync:

Rsync通常使用ssh进行通信。 它不需要特殊的安装权限。 但是,你必须有一个可用的ssh系统。

我假设你没有。 我可以推荐cygwin(安装后做ssh-host-config )。 然而,这往往不被认为是容易的。

你也可以select使用rsync守护进程。

  1. 写一个rsyncd.conf
  2. 运行rsync守护进程(请参阅cwRsync文档,或者现在只需在Windows机器上手动启动rsync – 守护进程)
  3. 而不是[email protected]:/some/real/path use例如[email protected]::somemodule/subpath/file.txt

一些背景: http : //www.itefix.no/i2/node/10650