安装

1
2
yum -y install xinetd
service xinetd restart

开启

编辑/etc/xinetd.d/rsync文件,将disable = yes修改为disable = no

1
2
3
4
5
service rsync
{
disable = no
.......
}

使用service xinetd restart启动

配置

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
cat > /etc/rsyncd.conf << EOF
uid = root
gid = root
use chroot = no
max connections = 20
secrets file = /etc/rsyncd.secrets
log file = /var/log/rsyncd.log
pid file = /var/run/rsyncd.pid
lock file /var/run/rsyncd.lock
[name1]
## 目录
path = /data/.svn_repos
## 用户名
auth users = svn
## 是否只读 yes是只读, no是可以上传
read only = yes
## 这个不知道怎么用
## write only = yes
## 运行的hosts
hosts allow = 192.168.1.253
## 是否列出该目录
list = true
[name2]
path = /data/hero/release/gameserver
auth users = mjyx
read only = yes
hosts allow = 102.168.1.253
list = true
EOF
cat > /etc/rsyncd.secrets << EOF
## 账号:密码
svn:passwd
EOF
chmod 600 /etc/rsyncd.secrets

客户端配置

1
2
3
4
5
6
7
8
cat > rsync.pas << EOF
passwd
EOF
chmod 600 rsync.pas
## 从远程更新
rsync -vazrtopguh --progress --password-file=rsync.pas svn@xxx.xxx.xxx.xxx::name1 name1
## 向远程推送
rsync -vazrtopguh --delete --progress --password-file.rsync.pas 本地目录 svn@xxx.xxx.xxx.xxx::name1