1、安装cwRsync_4.0.4_Installer.exe(默认路径安装)window只作为客户端,所以没装cwRsyncServer_4.0.4_Installer.exe
2、在C:\Program Files\cwRsync\bin新建rsync.bat,内容为:
"C:\Program Files\cwRsync\bin\rsync.exe" -rlptDvzHS --port=873 --progress --exclude=Recycled --exclude=RECYCLER --exclude="System Volume Information" --password-file=/cygdrive/C/"Program Files"/cwRsync/bin/rsync.pass /cygdrive/e/mydirtest root@linux服务器IP::rsync模块名
3、在C:\Program Files\cwRsync\bin新建rsync.pass,内容为:root用户执行rsync的密码
4、新建chmod.bat 内容为:"C:\Program Files\cwRsync\bin\chmod.exe" 600 "/cygdrive/C/Program Files/cwRsync/bin/rsync.pass"
5、执行chmod.bat 设置权限
6、执行rsync.bat,便将电脑上e盘的mydirtest传到linux服务器了。
从linux传文件到windows:
1、在windows安装cwRsyncServer_4.1.0_Installer.exe(默认路径安装)
2、windows上的rsyncd.conf配置信息:
cat rsyncd.conf
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
auth users = syncuser #同步使用的帐号
secrets file = /cygdrive/c/Program Files/ICW/rsyncd.secrets #密码文件
cat rsyncd.secrets
syncuser:123456
3、新建chmod.bat 内容为:
"C:\Program Files\ICW\bin\chmod.exe" 600 "/cygdrive/C/Program Files/ICW/bin/rsync.secrets"
执行chmod.bat 设置权限
4、在linux测试命令:
/usr/bin/rsync -rlptDvzHS --port=873 --progress --password-file=/etc/rsyncd.syncuser_pwd /a.txt [email protected]::test