服务端:192.168.1.10
客户端: 192.168.1.1
服务端
- 编辑配置文件
/etc/rsyncd.conf
uid = root
gid = root
use chroot = yes
address = 0.0.0.0
port 8731
pid file = /var/run/rsyncd.pid
log file = /var/log/rsyncd.log
hosts allow = 192.168.1.1
[rsyncbackup]
path = /data/rsync/backup
read only = false
dont compress = *.gz *.tgz *.zip *.z *.Z *.rpm *.deb *.bz2
auth users = backuper
secrets file = /etc/rsyncd_users.db
- 编辑备份用户名密码
/etc/rsyncd_users.db
注意权限为600
cat /etc/rsyncd_users.db
backuper:vF3pbzNbwe4HV
-rw------- 1 root root 26 Mar 21 11:29 /etc/rsyncd_users.db
- 启动rsyncd服务
rsync --daemon --config=/etc/rsyncd.conf --port=8731
客户端配置
- 配置密码
/etc/rsync.pass
注意权限也是600
cat /etc/rsync.pass
vF3pbzNbwe4HV
- 同步命令
rsync -avz --password-file=/etc/rsync.pass --port=8731 yourprojectname-bak.tar.gz backuper@192.168.1.10::rsyncbackup/yourprojectname/