- 准备两台服务器:192.168.50.11 (windows,做为服务端),192.168.50.14(Centos7,做为客户端)
1、在windows(192.168.50.11)上安装cwRsyncServer,下载地址:https://www.backupassist.com/rsync/
Service account:winrsync
安装步骤:Type password:RsyncUser123@ (密码必须复杂,要不不会创建系统用户,也不会抛错)
- 在安装目录下编辑配置文件rsyncd.conf 内容如下
uid = 0
gid = 0
use chroot = false
strict modes = false
hosts allow = *
log file = rsyncd.log
# Module definitions
# Remember cygwin naming conventions : c:\work becomes /cygwin/c/work
#
[test]
path = /cygdrive/c/work
read only = false
transfer logging = yes
[rsyncfile]
path = /cygdrive/c/rsyncfile/
auth users = winrsync
secrets file = etc/rsyncd.secrets
read only = false
hosts allow = * #IP段请自行修改
list = false
在E:\Program Files (x86)\ICW\etc新建 rsyncd.secrets,内容如下:
winrsync:RsyncUser123@
启动服务:
cmd-- services.msc找到RsyncServer服务启动
客户端操作:
安装rsync
yum -y install rsync
systemctl start rsyncd #启动
systemctl enable rsyncd #增加开机启动
echo 'RsyncUser123@' > /etc/rsync.passwd
chmod 600 /etc/rsync.passwd
创建测试目录与文件
mkdir -p /data/win
echo '111' > /data/win/1.txt
测试将客户端文件推送到服务端(在客户端操作)
rsync -avz /data/win/ winrsync@192.168.50.11::rsyncfile --password-file=/etc/rsync.passwd
可以在window端看到推送的文件
来源:oschina
链接:https://my.oschina.net/u/585210/blog/4314519