rsyncd脚本

root@ localhost ~]# vim rsyncd.sh 

#!/bin/bash
cat >/etc/rsyncd.conf<<EOF
#全局配置                       
uid = root
gid = root
use chroot = no
max connections = 200
timeout = 300
pid file = /var/run/rsyncd.pid
lock file = /var/run/rsync.lock
log file = /var/log/rsyncd.log

###模块配置                     
[backup]
path = /data
ignore errors
read only = false
list = false
hosts allow = 10.0.0.0/24
hosts deny = 0.0.0.0/32
auth users = rsync_backup
secrets file = /etc/rsync.password
EOF
mkdir -p /data
useradd rsync -s /sbin/nologin -M
chown -R rsync.rsync /data/
echo "rsync_backup:123456" >/etc/rsync.password
chmod 600 /etc/rsync.password
systemctl restart rsyncd.service
systemctl enable rsyncd.service
ssh root@10.0.0.50 > /dev/null <<eeooff
echo "123456">/etc/rsync.password
chmod 600 /etc/rsync.password 
eeooff

  

原文地址:https://www.cnblogs.com/gaiting/p/12307884.html