一堆命令部署rsync以及客户端部署
Posted
tags:
篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了一堆命令部署rsync以及客户端部署相关的知识,希望对你有一定的参考价值。
##环境准备server--172.16.1.41
client --172.16.1.31
server部署如下:
1 #!/bin/bash
2 #
3 rpm -qa rsync && yum install -y rsync
4 #
5 cat >>/etc/rsyncd.conf <<EOF
6 uid = rsync
7 gid = rsync
8 use chroot = no
9 max connections = 200
10 timeout = 300
11 pid file = /var/run/rsyncd.pid
12 lock file = /var/run/rsync.lock
13 log file = /var/log/rsyncd.log
14 ignore errors
15 read only = false
16 list = false
17 hosts allow = 172.16.1.0/24
18 hosts deny = 0.0.0.0/32
19 auth users = rsync_backup
20 secrets file = /etc/rsync.password
21 [backup]
22 comment = "backup dir by oldboy"
23 path = /backup
24 EOF
25 #
26 useradd -s /sbin/nologin -M rsync
27 #
28 echo "rsync_backup:oldboy123" >/etc/rsync.password
29 #
30 chmod 600 /etc/rsync.password
31 #
32 mkdir -p /backup && chown -R rsync.rsync /backup
33 #
34 rsync --daemon
client部署如下:
#!/bin/bash
#check info
#time 2018.01.29
#Software inspection and installation
rpm -qa rsync && yum -y install rsync
#Security authentication file
echo "oldboy123" >/etc/rsync.password && chmod 600 /etc/rsync.password
#Push test
rsync -avz /etc/hosts [email protected]::backup --password-file=/etc/rsync.password
以上是关于一堆命令部署rsync以及客户端部署的主要内容,如果未能解决你的问题,请参考以下文章