Synchronous backup file configuration method with Rsync in Linux

Source: Internet
Author: User
Tags auth rsync

Linux rsync sync settings

Rsync is a data mirroring backup tool that keeps data synchronized between two servers, and the most frequently used scenario is backing up the data.
The installation method is as follows:


Installing rsync under Ubuntu can be achieved by following these steps:

The code is as follows Copy Code
$ sudo apt-get install rsync xinetd

1. Edit/etc/default/rsync start rsync as daemon for using xinetd

The code is as follows Copy Code
$ sudo vim/etc/default/rsync

2. Create/etc/xinetd.d/rsync make rsync work through xinetd

The code is as follows Copy Code

$ sudo Vim/etc/xinetd.d/rsync
  Service rsync
         disable         = no
        socket_type     = Stream
        wait             = no
        user             = root
         server          =/usr/bin/rsync
         server_args     =--daemon
        log_on_failure  + = USERID

3. Create/etc/rsyncd.conf configuration rsync to make it in.

The code is as follows Copy Code

$ sudo vim/etc/rsyncd.conf
Max connections = 2
Log file =/var/log/rsync.log
Timeout = 300

Comment = Public Share
Path =/home/share
Read Only = no
List = yes
UID = nobody
GID = Nogroup
Auth users = user
Secrets file =/etc/rsyncd.secrets

4. Create/etc/rsyncd.secrets configuration username and password.

The code is as follows Copy Code

$ sudo vim/etc/rsyncd.secrets


The code is as follows Copy Code

$ sudo chmod 600/etc/rsyncd.secrets

5. Start/Restart XINETD

The code is as follows Copy Code

$ sudo/etc/init.d/xinetd Restart


Run the following command check to confirm that the rsync configuration was successful.

The code is as follows Copy Code

$ sudo rsync user@
Drwxr-xr-x 4096 2006/12/13 09:41:59.
Drwxr-xr-x 4096 2006/11/23 18:00:03 folders

if it doesn't work out, take a few notes:

The code is as follows Copy Code

Auth users = user

The user at the back is authorized to access the module and needs to correspond to the/etc/rsyncd.secrets.
Remote sync:

The code is as follows Copy Code

sudo rsync-arlhptgzqh--delete--delay-updates--progress fhp@serverip::share--password-file=/etc/rsync_password/ Media/server/server1/home


You just need to fill in the code.

Unfortunately, rsync synchronization does not automatically detect whether a directory has file updates or changes, and then synchronizes, and requires that we synchronize in the system's scheduled tasks.

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: 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.