Rsync 服务器端配置
Centos 6.3 已经自带Rsync服务
安装xinetd
# yum -y install xinetd
编辑/etc/xinetd.d/rsync文件,把disable = yes修改为disable = no
# default: off # description: The rsync server is a good addition to an ftp server, as it \ # allows crc checksumming etc. service rsync { disable = no flags = IPv6 socket_type = stream wait = no user = root server = /usr/bin/rsync server_args = --daemon log_on_failure += USERID }
启动Xinetd
# /etc/init.d/xinetd start
编辑/etc/rsyncd.conf,设置Rsync服务
# vi /etc/rsyncd.conf
max connections = 2 lock file = /var/run/rsync.lock log file = /var/log/rsyncd.log pid file = /var/run/rsyncd.pid timeout = 300 [down] #模块名 comment = Web Files Sync path = /home/website.com/public_html #同步目录 ignore errors read only = yes #只读,禁止客户端修改 list = yes uid = nobody gid = nobody auth users = DownSync #允许连接的用户名 secrets file = /etc/rsyncd.secrets #密码文件 hosts allow = 192.99.0.0/255.255.0.0 #允许连接的网段,新增服务器后, 需要把新服务器的网段加入,不然无法进行同步 [upload] comment = Web Files Upload path = /home/website.com/public_html ignore errors read only = false list = yes uid = root gid = root auth users = UploadSync secrets file = /etc/rsyncd.secretsup
编辑密码文件
# vi /etc/rsyncd.secrets
DownSync:Password#用户名:密码
给密码文件加上正确的权限
# chmod 600 /etc/rsyncd.secrets
Learn how to learn~~