0%

rsync简单使用

无用户名密码共享文件:

1
2
3
4
5
6
7
8
9
10
11
12
13
14
uid = root
gid = root
use chroot = no
max connections = 100
pid file = /var/run/rsyncd.pid
lock file = /var/run/rsyncd.cock
log file = /var/log/rsync.log
list = no
strict modes = no

[rdata]
path = /home/rsync_fwg
read only = yes
hosts allow = 192.168.112.243,192.168.104.112,192.168.112.136

使用密码文件进行用户认证共享:

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
# Minimal configuration file for rsync daemon
# See rsync(1) and rsyncd.conf(5) man pages for help

# This line is required by the /etc/init.d/rsyncd script
# GLOBAL OPTIONS
uid = root
gid = root
use chroot = yes
read only = no
max connections = 50

pid file = /var/run/rsyncd.pid

secrets file = /etc/rsyncd.secrets
#lock file = /var/run/rsync.lock

#This will give you a separate log file
log file = /var/log/rsync.log

timeout = 600

# MODULE OPTIONS
[game]
path = /home/dir/gameantispam/pluguser
#ignore errors
auth users = game
#comment = gameantispam

/etc/rsyncd.secrets 文件:

1
game:game

启动 rsync:

1
rsync --daemon --config=/etc/rsyncd.conf --port=8723

远程同步:

  • 无用户同步:```
    rsync -avR –delete –port=8723 192.168.112.243::rdata/ ./
1
2
3

* 用户认证同步: ```
rsync -avR --delete --port=8723 [email protected]::antiplug/ ./