跳转至

cwRsyncServer 4.1.0 配置

一、安装步骤

1.1 下载

文件名: cwRsyncServer_4.1.0_Installer.exe

下载: https://download.lovev.top/soft/windows/cwRsyncServer_4.1.0_Installer.exe

1.2 安装

  1. 双击运行 cwRsyncServer_4.1.0_Installer.exe
  2. 安装路径用默认的:C:/Program Files (x86)/ICW
  3. Service Account 设置(创建 Windows 服务账户):
  • Service account: SvcCWRSYNC(保持默认 SvcCWRSYNC)
  • Type password: 输入随机生成的密码(密码可能后续修复时有用,没必要记录
  • Confirm password: 再次输入
  • img
  1. 上边都保持默认,安装即可

1.3 启动服务

Text Only
1
2
3
4
1. Win + R → 输入 services.msc
2. 找到 "RsyncServer" 服务
3. 右键 → 属性 → 启动类型设为"自动"
4. 点击"启动"按钮

img

1.4 配置防火墙

图形创建,网络-右键属性- Windows Defender 防火墙-高级设置-入站规则-新建规则

Text Only
1
2
3
4
5
规则类型:端口
协议和端口:TCP-特定本地端口(873)
操作:允许连接
配置文件:专用(我一般为专用网络)
名称:RsyncServer

二、服务端配置

2.1 编辑 rsyncd.conf

文件位置: C:/Program Files (x86)/ICW/rsyncd.conf

编辑内容:

INI
# 全局配置
use chroot = false
strict modes = false
hosts allow = *
log file = rsyncd.log
uid=0
gid=0

# Module definitions
# Remember cygwin naming conventions : c:\work becomes /cygwin/c/work

# 自定义模块data 
[data]
# 实际同步路径
path = /cygdrive/f/back
# 配置只读
read only = false
# 允许打印列表
list = yes
# 允许的主机列表,逗号分隔
hosts allow = 172.16.1.18,172.16.1.21
# 认证用户
auth users = rsync_user
# 密码文件路径
secrets file = etc/rsyncd.secrets

重要说明:

  • gid = 0uid = 04.1.0 版本必须有这两行!
  • path — Cygwin 格式路径(f 盘写成 /cygdrive/f/
  • auth users — 认证用户名(自定义)
  • secrets file — 密码文件路径(Cygwin 格式)

2.2 创建密码文件

文件位置: C:/Program Files (x86)/ICW/etc/rsyncd.secrets

创建内容:

INI
rsync_user:123456

格式说明:

  • 格式:用户名:密码
  • 一行一个用户
  • 密码至少 8 位,建议包含大小写、数字、特殊字符

设置权限:

  1. 右键 rsyncd.secrets → 属性 → 安全
  2. 删除所有用户,只保留 Administrators
  3. 权限设为"完全控制"

2.3 重启服务

Text Only
1
2
3
1. Win + R → 输入 services.msc
2. 找到 "RsyncServer" 服务
3. 右键 → 重新启动

三、Linux 客户端配置

3.1 创建密码文件

Bash
1
2
3
4
5
6
7
8
# 创建目录
mkdir -p ~/.rsync

# 创建密码文件
echo "123456" > ~/.rsync/rsyncd.secrets

# 设置权限(必须 600!)
chmod 600 ~/.rsync/rsyncd.secrets

3.2 手动同步测试

从 Windows 同步到 Linux(拉取模式):

Bash
1
2
3
4
5
6
7
8
# 测试连接(空运行,不实际传输)
rsync -avn --password-file=~/.rsync/rsyncd.secrets \
  rsync_user@<Windows_IP>::data \
  /nas/homes/back-caiwu/back/
# 实际同步
rsync -avP --delete --password-file=~/.rsync/rsyncd.secrets \
  rsync_user@<Windows_IP>::data \
  /nas/homes/back-caiwu/back/

参数说明:

  • -a - 归档模式(保留权限、时间戳等)
  • -v - 详细输出
  • -z - 压缩传输(内网可以不用,节约CPU负载)
  • -n - 空运行(测试用,不实际传输)
  • -P - 进度显示 + 断点续传
  • --delete — 源删除则目标删除
  • --password-file — 密码文件路径

路径说明:

  • <Windows_IP> — Windows 主机的 IP 地址
  • data — rsyncd.conf 中定义的模块名
  • /nas/homes/back-caiwu/back/ — Linux 目标路径

3.3 带斜杠和不带斜杠的区别

Bash
1
2
3
4
5
# 同步整个目录(包括目录本身)
rsync ... rsync_user@IP::data /nas/...

# 同步目录下的所有内容(不包括目录本身)
rsync ... rsync_user@IP::data/ /nas/...

推荐:data/(带斜杠),只同步内容