Rsync reinforcement technology synchronizes only the required servers through scripts

Source: Internet
Author: User
Rsync hardening technology (when firewall is enabled by manually modifying the port) and synchronizing only the desired server through the script

Client: 192.168.0.22, 192.168.0.20

Server: 192.168.0.21 (source) is used to synchronize with other servers.


I wrote earlier

Http://chenhao6.blog.51cto.com/6228054/1298375inotify+rsync+mutt+msmtp enables automatic update of linux files or directories and sends emails to administrators

However, some functions cannot be implemented. what do you do if you want to update only a few of them.

The solution is provided here.

First, the client configuration script 192.168.0.22

1234567891011121314151617181920212223242526 #!/bin/bash# Client 192.168.0.22 (multiple)yum -y installrsynccat>> /etc/rsyncd.conf << EOFuid = rootgid = rootuse chroot = nomax connections = 100timeout = 600pid file=/var/run/rsyucd.pidlock file= /var/run/rsyncd.locklog file= /var/log/rsyncd.log[www]path = /home/wwwignore errorsreadonly = nolist = nohosts allow = 192.168.0.21/255.255.255.0auth users= www1secrets file= /etc/www1.pwdEOFecho"www1:123">> /etc/www1.pwdchmod600 /etc/www1.pwdecho"Welcome to use the rsync services">> /var/rsyncd.motd/usr/bin/rsync--daemonecho"/usr/bin/rsync --daemon">> /etc/rc.local

192.168.0.20 client configuration script

12345678910111213141516171819202122232425262728 #!/bin/bash# Client 192.168.0.20# What are the meanings of these configuration files? previous articles have written specific articles. please refer to the connection above.yum -y installrsynccat>> /etc/rsyncd.conf << EOFuid = rootgid = rootuse chroot = nomax connections = 100timeout = 600pid file=/var/run/rsyucd.pidlock file= /var/run/rsyncd.locklog file= /var/log/rsyncd.log[www]path = /home/wwwignore errorsreadonly = nolist = nohosts allow = 192.168.0.21/255.255.255.0# Comment out the comment here. if anyone is allowed to access multiple hosts, add a space of 192.168.0.22/255.255.255.0.auth users= www1secrets file= /etc/www1.pwdEOFecho"www1:123">> /etc/www1.pwdchmod600 /etc/www1.pwdecho"Welcome to use the rsync services">> /var/rsyncd.motd/usr/bin/rsync--daemonecho"/usr/bin/rsync --daemon">> /etc/rc.local


1 1

The following key moments are coming.

1 service iptables start

Both servers run

12 /usr/bin/rsync-- Address = 192.168.0.22 -- port = 998 -- daemon his own port/usr/bin/rsync-- Address = 192.168.0.21 -- port = 998 -- daemon updates the source port

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.