Rsync

本文详细介绍rsync客户端和服务端的配置过程。客户端通过cron定时任务每10分钟执行一次同步脚本,确保本地文件与远程服务器保持一致。服务端配置了认证用户、最大连接数等参数,并使用密码文件进行身份验证。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

rsync客户端配置

显示代码
01
02
03
04
05
06
07
08
09
10
11
12
13
14
15
16
[root@server05 ~] # crontab -l
* /10 * * * * /home/system/rsync/rsync .sh
[root@server05 ~] # more  /home/system/rsync/rsync.sh
#!/bin/bash
if test -e /tmp/rsync .pid
then
exit
else
touch /tmp/rsync .pid
/home/system/rsync/bin/rsync -uvrtopg --delete --password- file = /home/system/rsync/rsync . passwd root@192.168.1.2::down /home/down
rm -rf /tmp/rsync .pid
fi
[root@server05 ~] # more  /home/system/rsync/rsync.passwd
d9jYijw
[root@server05 ~] # cd
rsync . passwd 600

rsync服务器端设置

显示代码
01
02
03
04
05
06
07
08
09
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
[root@server02 ~] # cd /etc/
[root@server02 etc] # more rsyncd.conf
uid = root
gid = root
use chroot = no
max connections = 10
pid file = /var/run/rsyncd .pid
lock file = /var/run/rsync .lock
log file = /var/log/rsyncd .log
[down]
path = /home/down/
auth users = root
uid = root
gid = root
read only = true
secrets file = /etc/rsyncd .secrets
[root@server02 etc] #
[root@server02 etc] # more rsyncd.secrets
root:d9jYijw-&tTem60
[root@server02 etc] #
[root@server02 etc] # ll rsyncd.conf
-rw-r--r--  1 root root 271 2008-06-01  rsyncd.conf
[root@server02 etc] # ll rsyncd.secrets
-rw-------  1 root root 21 2007-10-31  rsyncd.secrets
[root@server02 etc] #rsync --daemon --config=/etc/rsyncd.conf
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值