使用rsync同步Linux數據到Windows

windows: win7,cwrsyncserver 4.1.0
linux

linux:ubuntu 14.04,rsync 3.1.0apache

networks:使用360wifiubuntu

【Windows端】windows

是否使用管理員登陸沒有關係安全

1. 安裝cwrsyncserver,用戶名任意,這裏使用的是apache服務器

2. 修改rsyncd.conf配置文件測試

use chroot = false
strict modes = false
hosts allow = *
log file = rsyncd.log
uid = 0  #要加上這兩行,不然會出現@ERROR:invalid uid nobody錯誤
gid = 0  #要加上這兩行ui

[www]
path = /cygdrive/d/rsync/www
ignore errors
read only = no
list = no
host allow = 172.24.202.0/255.255.0.0
auth users = rsync
secrets file = rsyncd.password
transfer logging = yesspa

3. 建立rsyncd.password文件,放入軟件安裝目錄server

rsync:password  用戶名:密碼

4. 把C:\Program Files (x86)\ICW加入系統環境變量path,不必設置這一步

設置rsyncd.password文件的權限,chmod 600 rsyncd.password  可是彷佛設置無效,並且也沒有必要設置

5. 建立d:/rsync/www文件夾,屬性->安全,添加rsync用戶,並賦予所有權限

6. 關閉windows防火牆

【Linux端】

1. 建立目錄/home/user/rsync

2. 建立目錄/home/user/rsync/www

3. 建立文件rsyncd.password

password  注意這裏只有密碼,不然cwrsyncserver會出現password mismatch錯誤

rsync:password  兩種形式能夠都試一下,有的系統要求第一種,有的系統兩種均可以

4. 設置文件rsyncd.password權限

chmod 600 rsyncd.password  #不然會出現@ERROR:password file must not be other-accessible錯誤

5. telnet 172.24.202.1 873,測試是否能連到windows的rsync服務器

6. rsync -avz www/ rsync@172.24.202.1::www --password-file=rsyncd.password

 

Linux端:@ERROR:auth failed on module www

Windows端:missing secret for user "rsync"

低級錯誤,通常是配置文件中secrets file部分和secret文件名不匹配,或者密碼錯誤

 

參考:

http://www.ilanni.com/?p=8646

http://willvvv.iteye.com/blog/1480390

相關文章
相關標籤/搜索