协商 rsync 协议版本时出现问题

协商 rsync 协议版本时出现问题

我正在尝试在 Linux 系统和 MacOS 系统之间进行 rsync。

MacOS (yosemite) 似乎附带了旧版本的 rsync,因此我使用 homebrew 对其进行了更新。好的,我似乎有完全匹配的版本:

wim@wim-imac:~$ rsync --version | head -n 1
rsync  version 3.1.1  protocol version 31
wim@wim-imac:~$ ssh wim@wim-dell
wim@wim-dell:~$ rsync --version | head -n 1
rsync  version 3.1.1  protocol version 31

如果它是从 MacOS 框中“拉”出来的(即目标是本地而源是远程的),它就可以工作:

wim@wim-imac:~$ rsync -nvvvv wim@wim-dell:/media/wim/wim_2tb/guitar /Volumes/wim2TB/guitar | grep Protocol
(Server) Protocol versions: remote=31, negotiated=31
(Client) Protocol versions: remote=31, negotiated=31

但如果将它从源框(linux)推送到 mac,现在就会出现一个小问题 - 协议不匹配。

wim@wim-imac:~$ ssh wim@wim-dell
wim@wim-dell:~$ rsync -nvvvv /media/wim/wim_2tb/guitar wim@wim-imac:/Volumes/wim2TB/guitar | grep Protocol
(Server) Protocol versions: remote=31, negotiated=29
(Client) Protocol versions: remote=29, negotiated=29

因此,这种情况的症状是,由于我们已经协商了最低公分母协议 29,所以我得不到支持,--iconv并且任何带有奇怪字符的文件名都会被搞砸。

wim@desk35:~$ rsync -nv --iconv=UTF-8,UTF8-MAC /media/wim/wim_2tb/guitar wim@wim-imac:/Volumes/wim2TB/guitar
rsync: on remote machine: --iconv=UTF8-MAC: unknown option
rsync error: syntax or usage error (code 1) at /SourceCache/rsync/rsync-45/rsync/main.c(1333) [server=2.6.9]
rsync: connection unexpectedly closed (0 bytes received so far) [sender]
rsync error: error in rsync protocol data stream (code 12) at io.c(226) [sender=3.1.1]

我使用、查找了rsyncd可能在 Mac 上运行的任何类型的 kick ps auxps -ef但没有找到。

为什么 Mac 机器在远程联系时会选择旧协议版本,我该如何让它使用我安装的较新版本的 rsync?

答案1

我猜想自制版本的 rsync 位于 /usr/local/bin 而不是 /usr/bin(应该是这样的),但从 Linux 机器进行 rsync 时,它会将 /usr/bin/rsync 作为远程代理执行。如果这是问题所在,您应该能够通过添加--rsync-path=/usr/local/bin/rsync(或 OS X 端的实际路径)来修复它。

注意:请不要替换 /usr/bin 目录中 Apple 提供的 rsync 版本——那样会造成疯狂。

相关内容