Rsync / 运维

RSYNC.3.脚本实现部署

~]# cat rsync_install.sh
#!/bin/bash
#1.Install Rsync Server
yum install -y rsync
#2.Create User For Rsync
useradd -M -s /sbin/nologin rsync
#3.Create Directory for backup, modify folder properties.
mkdir /backup
chown -R rsync.rsync /backup
#4.modify config file.
cat >/etc/rsyncd.conf<<EOF
uid = rsync
gid = rsync
port = 873
fake super = yes
use chroot = no
max connections = 200
timeout = 600
ignore errors
read only = false
auth users = rsync_backup
secrets file = /etc/rsync.password
log file = /var/log/rsyncd.log
##################################
[backup]
comment = welcome to rsync backup
path = /backup
EOF
#5.create auth file
echo “rsync_backup:1” > /etc/rsync.password
chmod 600 /etc/rsync.password
#6.Start rsync Servers
systemctl start rsyncd &>/dev/null
systemctl enable rsyncd &>/dev/null
systemctl status rsyncd &>/dev/null && echo “rsyncd start successed.”

发表者

shi351953026@126.com
一个在IT苦海中遨游的老菜鸟

Comments

Evahe
2022年1月20日 at 14:47

…………。



发表回复

您的电子邮箱地址不会被公开。 必填项已用 * 标注