- server端设置
修改/etc/default/rsync
RSYNC_ENABLE=true
RSYNC_OPTS='--address=10.192.0.5'
RSYNC_NICE=''
- 修改/etc/rsyncd.conf
# sample rsyncd.conf configuration file
# GLOBAL OPTIONS
#motd file=/etc/motd
uid = nobody
gid = nogroup
use chroot = no
max connections = 10
strict modes = yes
log file=/var/log/rsyncd.log
# for pid file, do not use /var/run/rsync.pid if
# you are going to run rsync out of the init.d script.
# pid file=/var/run/rsyncd.pid
#syslog facility=daemon
#socket options=
# MODULE OPTIONS
[cashare]
comment = CA-Share
path = /home/cashare
uid = root
gid = root
read only = yes
hosts allow = 10.192.0.0/24
list = false
ignore erros
auth users = backup
secrets file = /etc/rsync.pass
transfer logging = yes
log format = %t: host %h (%a) %o %f (%l bytes). Total %b bytes.
基本上配置还是比较好理解的了。
创建/etc/rsync.pass
chmod 600 /etc/rsync.pass
echo ‘backup:backup’ > /etc/rsync.pass
- 客户端配置:
命令格式:
/usr/bin/rsync -vzrtopg --delete --progress backup@10.192.0.5::cashare /backup-10.192.0.5 --password-file=/etc/rsync.pass
写入到crontab
cat /etc/rsync.pass
backup
- 犯得错误:
rsync: failed to connect to 192.168.1.106: Connection refused (111)
rsync error: error in socket IO (code 10) at clientserver.c(124) [receiver=3.0.6]
应该和下面原因相同
root@InnerServer3:/etc# rsync -vzrtopg --delete --progress gitlab@10.192.0.5:gitlab /backup-10.192.0.5/
gitlab@10.192.0.5's password:
Permission denied, please try again
ip之后应该是::而不是:,疏忽啊
@ERROR: auth failed on module gitlab
rsync error: error starting client-server protocol (code 5) at main.c(1534) [Receiver=3.0.8]
在client的密码文件中,只保存密码。