主服務器192.168.1.100 yum install rsync
rsyncd.conf配置html
uid = apache gid = apache port = 873 max connections = 100 pid file = /var/run/rsyncd.pid log file = /var/log/rsyncd.log lock file = /var/lock/rsyncd.lock auth users = rsync motd file = /etc/rsyncd/rsyncd.motd secrets file = /etc/rsyncd.secrets ignore errors read only = yes list = no timeout = 60 [t] path = /var/www/html/test
密碼文件rsyncd.secrets內容,用戶名須要注意填寫和配置文件裏的auth users 用戶名:密碼 好比: rsync:testabc
/usr/bin/rsync --daemon 啓動shell
ps aux | grep rsync 查找進程,並kill死apache
root 2716 0.0 0.0 107620 640 ? Ss 20:56 0:00 /usr/bin/rsync --daemon root 2727 0.0 0.0 103244 856 pts/1 S+ 20:59 0:00 grep rsync
在從服務器安裝完成rsync後,配置密碼文件服務器
創建密碼文件:rsyncd.secrets,此密碼文件不須要用戶名,只填寫與主服務器上密碼相同便可 rsync -avzP --delete --password-file=/root/rsyncd.secrets rsync@192.168.1.101::t /var/www/html/test