BackupPC - 为什么它使用 rsync --sender --server ...?

Jak*_*son 5 backuppc

我正在 CentOS 5.5 服务器上试验 BackupPC。我几乎用默认值设置了所有东西。

我尝试为主机的 /www 目录设置基本备份。备份失败并出现以下错误:

full backup started for directory /www
Running: /usr/bin/ssh -q -x -l root target /usr/bin/rsync --server --sender --numeric-ids --perms --owner --group -D --links --hard-links --times --block-size=2048 --recursive --ignore-times . /www/
Xfer PIDs are now 30395
Read EOF: Connection reset by peer
Tried again: got 0 bytes
Done: 0 files, 0 bytes
Got fatal error during xfer (Unable to read 4 bytes)
Backup aborted (Unable to read 4 bytes)
Not saving this as a partial backup since it has fewer files than the prior one (got 0 and 0 files versus 0)
Run Code Online (Sandbox Code Playgroud)

首先,是的,我设置了 ssh 密钥,允许我在不需要密码的情况下通过 ssh 连接到目标服务器。

在排查过程中,我直接从命令行尝试了上面的ssh命令,挂了。查看 SSH 调试消息的结尾,我得到:

debug1: Sending subsystem: /usr/bin/rsync --server --sender --numeric-ids --perms --owner --group -D --links --hard-links --times --block-size=2048 --recursive --ignore-times . /www/
Request for subsystem '/usr/bin/rsync --server --sender --numeric-ids --perms --owner --group -D --links --hard-links --times --block-size=2048 --recursive --ignore-times . /www/' failed on channel 0
Run Code Online (Sandbox Code Playgroud)

接下来我开始查看 rsync 标志。我不认识--server--sender。纵观rsync手册页,果然,我没有看到任何东西--server--sender在那里。里面的人是干什么的?

查看 BackupPC 配置我有这个:

RsyncClientPath = /usr/bin/rsync
RsyncClientCmd = $sshPath -q -x -l root $host $rsyncPath $argList+
Run Code Online (Sandbox Code Playgroud)

对于参数,我列出了以下内容:

--numeric-ids
--perms
--owner
--group
-D
--links
--hard-links
--times
--block-size=2048
--recursive
Run Code Online (Sandbox Code Playgroud)

请注意,没有--server,--sender--ignore-times。为什么要添加这些东西?这是问题的一部分吗?

Zor*_*che 4

这些--server --sender是在管道上运行 rsync 时使用的选项。rsync 服务器设置在远程端,以便它可以执行所有校验和和增量编码魔法,以便您仅通过线路传输更改的位。这可能没有记录在手册页中,因为它们是自动添加的,通常不需要了解或关心它们。

来自man rsync(1)

选项 --server 和 --sender 由 rsync 在内部使用,在正常情况下用户不应键入这些选项。在某些情况下可能需要了解这些选项,例如设置只能运行 rsync 命令的登录名时。例如,rsync 发行版的支持目录有一个名为 rrsync(用于受限 rsync)的示例脚本,可以与受限 ssh 登录一起使用。