1. 程式人生 > >一堆命令部署rsync以及客戶端部署

一堆命令部署rsync以及客戶端部署

-s 客戶 error 1.3 nor onf login 8.0 ack

##環境準備
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以及客戶端部署