rsyncd服务器配置使用
在服务器192.168.9.66上使用rsync充当服务器端。编写配置文件/etc/rsyncd/rsyncd.conf如下:
pid file = /run/rsyncd.pid
port = 873
address = 192.168.9.66
uid = root
gid = root
use chroot = yes
read only = no
write only = no
hosts allow = 192.168.9.64
hosts deny = *
max connections = 5
motd file = /etc/rsyncd/rsyncd.motd
log file = /var/log/rsyncd.log
transfer logging = yes
log format = %t %a %m %f %b
syslog facility = local3
timeout = 300
[data1]
path=/root/syncdir
list=yes
#ignore errors
auth users = data1user
secrets file=/etc/rsyncd/rsyncd.secrets
comment = some description about this moudle
exclude = test1/ test2/
在文件/etc/rsyncd/rsyncd.secrets中添加用户及密码:
# cat /etc/rsyncd/rsyncd.secrets
data1user:data1234
使用下面命令开启rsync服务器:
rsync --daemon --config=/etc/rsyncd/rsyncd.conf
在192.168.9.64上同步[data1]:
添加一个密码文件,使用哪个用户就在里面写哪个用户的密码:
# cat rsync.password
data1234
rsync -avzP --delete --password-file=/root/rsync.password ./syncdir/ data1user@192.168.9.66::data1