请先安装rsync软件。
motd file = /etc/rsyncd/rsyncd.motd
read>list = yes
uid = nobody
gid = nobody
#uid = root
#gid = root
use chroot = no
read only = no
max connections = 5
log file = /var/log/rsyncd.log
pid file = /var/run/rsyncd.pid
lock file = /var/run/rsync.lock
[webhome]
comment = testsync directory
path = /var/www
auth users = root
secrets file = /etc/rsyncd/rsyncd.secrets
权限设置:
chmod 777 /etc/rsyncd/rsyncd.secrets
chmod 777 /var/www
文件内容:
[root@localhost rsync]# cat ./rsyncd/rsyncd.confmotd file = /etc/rsyncd/rsyncd.motd
read>list = yes
uid = nobody
gid = nobody
#uid = root
#gid = root
use chroot = no
read only = no
max connections = 5
log file = /var/log/rsyncd.log
pid file = /var/run/rsyncd.pid
lock file = /var/run/rsync.lock
[webhome]
comment = testsync directory
path = /var/www
auth users = root
secrets file = /etc/rsyncd/rsyncd.secrets
hosts allow = 192.168.2.115
[root@localhost rsync]# cat /etc/rsyncd/rsyncd.secrets
root:123456
启动:
/usr/bin/rsync --daemon --config=/etc/rsyncd/rsyncd.conf
自启动:
echo "/usr/bin/rsync --daemon --config=/etc/rsyncd/rsyncd.conf" >> /etc/rc.local