为什么此 rsync 连接在 Windows 上意外关闭?
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/7261029/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
Why is this rsync connection unexpectedly closed on Windows?
提问by rkmax
I'm trying to use rsync
on Windows 7. I installed cwRsync and tried to connect to Ubuntu 9.04.
我正在尝试rsync
在 Windows 7上使用。我安装了 cwRsync 并尝试连接到 Ubuntu 9.04。
$ rsync -azC --force --more-options ./ user@server:/my/path/
rsync: connection unexpectedly closed (0 bytes received so far) [receiver]
rsync error: error in rsync protocol data stream (code 12) at io.c(600) [receiver=3.0.5]
rsync: connection unexpectedly closed (0 bytes received so far) [sender]
rsync error: error in rsync protocol data stream (code 12) at io.c(610) [sender=3.0.8]
采纳答案by rkmax
i get the solution. i've using cygwin and this is the problem the rsync command for Windows work only in windows shell and works in the windows powershell.
我得到了解决方案。我一直在使用 cygwin,这是 Windows 的 rsync 命令只能在 windows shell 中工作并在 windows powershell 中工作的问题。
A few times it has happened the same error between two linux boxes. and appears to be by incompatible versions of rsync
有几次它在两个 linux 机器之间发生了同样的错误。并且似乎是由不兼容的 rsync 版本引起的
回答by Petah
The trick for me was I had ssh
conflict.
对我来说,诀窍是我有ssh
冲突。
I have Git installed on my Windows path, which includes ssh. cwrsync also installs ssh.
我的 Windows 路径上安装了 Git,其中包括 ssh。cwrsync 还安装 ssh。
The trick is to have make a batch file to set the correct paths:
诀窍是制作一个批处理文件来设置正确的路径:
rsync.bat
rsync.bat
@echo off
SETLOCAL
SET CWRSYNCHOME=c:\commands\cwrsync
SET HOME=c:\Users\Petah\
SET CWOLDPATH=%PATH%
SET PATH=%CWRSYNCHOME%\bin;%PATH%
%~dp0\cwrsync\bin\rsync.exe %*
On Windows you can type where ssh
to check if this is an issue. You will get something like this:
在 Windows 上,您可以键入where ssh
以检查这是否是一个问题。你会得到这样的东西:
where ssh
C:\Program Files (x86)\Git\bin\ssh.exe
C:\Program Files\cwRsync\ssh.exe
回答by Seth Wegner
I saw this when changing rsync versions. In the older version, it worked to say:
我在更改 rsync 版本时看到了这一点。在旧版本中,它可以说:
rsync -e 'ssh ...
rsync -e 'ssh ...
when the rsync.exe
and ssh.exe
were in the same directory.
当rsync.exe
和ssh.exe
位于同一目录中时。
With the newer version, I had to specify the path:
对于较新的版本,我必须指定路径:
rsync -e './ssh ...
rsync -e './ssh ...
and it worked.
它奏效了。
回答by Mark
I had this problem, but only when I tried to rsync from a Linux (RH) server to a Solaris server. My fix was to make sure rsync had the same path on both boxes, and that the ownership of rsync was the same.
我遇到了这个问题,但只有当我尝试从 Linux (RH) 服务器到 Solaris 服务器时才会出现此问题。我的解决方法是确保 rsync 在两个盒子上具有相同的路径,并且 rsync 的所有权是相同的。
On the linux box, rsync path was /usr/bin, on Solaris box it was /usr/local/bin. So, on the Solaris box I did ln -s /usr/local/bin/rsync /usr/bin/rsync.
在 linux 机器上,rsync 路径是 /usr/bin,在 Solaris 机器上它是 /usr/local/bin。所以,在 Solaris 机器上我做了 ln -s /usr/local/bin/rsync /usr/bin/rsync。
I still had the same problem, and noticed ownership differences. On linux it was root:root, on solaris it was bin:bin. Changing solaris to root:root fixed it.
我仍然遇到同样的问题,并注意到所有权差异。在 linux 上它是 root:root,在 solaris 上它是 bin:bin。将 solaris 更改为 root:root 修复了它。
回答by davidgo
I had this error coming up between 2 Linux boxes. Easily solved by installing RSYNC on the remote box as well as the local one.
我在 2 个 Linux 机器之间出现了这个错误。通过在远程盒子和本地盒子上安装 RSYNC 轻松解决。
回答by phihag
This error message probably means that you either mistyped the server name or forgot to start an ssh server at server. Make absolutely certain that an ssh server is running on the server at port 22, and that it's not firewalled. You can test that with ssh user@server
.
此错误消息可能意味着您输入错误的服务器名称或忘记在server上启动 ssh服务器。确保 ssh 服务器在端口 22 的服务器上运行,并且它没有防火墙。你可以用ssh user@server
.