rsync在服务器之间通信备份(包括window和linux之间)

rsync在服务器之间通信备份(包括window和linux之间):
linux和linux之间:

服务器:192.168.1.1
客户端:192.168.1.2


服务端:

uid = nobody
gid = nobody
use chroot = no        
max connections = 3
transfer logging = true
log format = %h %o %f %l %b
pid file = /var/run/rsyncd.pid
lock file = /var/run/rsync.lock
log file = /var/log/rsyncd.log
hosts allow = 192.168.1.2

[project]
path = /home/hosts/
exclude = app_log/ resin_log/ *.tar.gz *.tar *.gz *.zip .*
comment = BACKUP CLIENT IS SOLARIS 8 E250
ignore errors
read only = yes
list = no
auth users=rsync_guagua
secrets file = /etc/rsyncd.secrets

配置一下密码文件即可。
文件格式如下:rsync_guagua:111111(用户名:密码)

客户端:
rsync -vzrtopg --progress --update [email protected]::project $mainProjectDir/26 --password-file=/usr/local/bin/rsyncd.pwd>/var/log/rsync.26.prj.$DATE.log
配置下密码文件:只需配置密码,如:111111


linux和linux的通讯完成。

linux和window的通讯,linux为客户端,window为服务端

window需要安装cwRsyncServer软件。安装后,修改安装目录的rsync.conf文件,然后去服务中手动启动该服务即可。
注:该软件监听的是873端口,请确保防火墙打开此端口

服务端配置如下:
UID = 0
GID = 0
use chroot = false
strict modes = false
hosts allow = *
log file = rsyncd.log
pid file = rsyncd.pid

[test]
path = /cygdrive/e/test
read only = yes
transfer logging = yes
ignore errors
list = no
auth users=rsync_guagua
secrets file = /cygdrive/e/rsyncd.secrets

改配置同linux服务端不一样的是UID和GID,这里必须这样配置,否则报错
@ERROR: invalid uid nobody
rsync error: error starting client-server protocol (code 5) at main.c(1506) [Receiver=3.0.2]

客户端同linux,客户端的密钥文件必须具有600的权限,否则报错:
password file must not be other-accessible


下面收藏一个rsync常出错的错误信息收集地址:
http://www.codesky.net/article/201202/162163.html

猜你喜欢

转载自guying1028.iteye.com/blog/1728155
今日推荐