Install rsync on the Debian 4.0 RC3 for remote backup notes

Source: Internet
Author: User
Tags auth chmod rsync

Author: He Zubin [Robinhe] mail:zubin.he@gmail.com
Beginning on the morning of August 4, 2008
Version number: debian-rsync-v1.0-20080804, August 4, 2008 first edition

Reprint please indicate the source, this article is also the use of two users of most of the content, so reproduced, please also the following "reference article" of the source also joined. Thank you.
This article is bound to have deficiencies, omissions, typos and sentences are not in place, such as discovery, or have updated the change of place, please contact me and when corrected and perfect.

System Information:
Server OS: Debian 4.0 RC3
IPAddress: 222.222.222.222 [Imaginary]

Client OS: Debian 4.0 RC3
IPAddress: 111.111.111.111 [Imaginary]


Instructions for use:
The vast majority of the green bold font is the result of the input command and the system output display.


Reference Articles:
http://community.itbbs.cn/showthread.php?t=7395


first, server-side settings:

First, install the Rsync software:
#apt-get Install rsync

The default rsync service is turned off after installation. You need to open it in the/etc/default/rsync file. This file is a Debian-specific setting that is used to set whether rsync runs in service mode and configures service ports [can be changed, default is 873], and IP addresses. Only the server side (222.222.222.222) on the line, the client does not have to open.
#vi/etc/default/rsync
Will be the original:
Rsync_enable=false
To
rsync_enable=true
The others don't have to be more.
Save exit

Second, set up the configuration file for rsync/etc/rsyncd.conf--on the server side, that is, 222.222.222.222
#vi/etc/rsyncd.conf

Log file =/var/log/rsyncd.log, set the location of log files, and automatically generate this file when you start rsync

[Backup1]; the first project name that requires remote backup, IP is 333.333.333.333
Path =/home/allsystembackup/backup1 Remote backup, this directory must be created before you start rsync, or startup will fail
Comment = Backup Server1
UID = root
GID = root
Read Only = no; Remote backup can write to this directory
Auth users = backupuser1; A user name that can be authenticated, separated by a number of
Secrets file =/etc/rsync.pass user authentication files, that is, the password file name, the client to be backed up, you must add a username and password here, this file is a plaintext password
Hosts allow 333.333.333.333 What IP is allowed to back up this item, can be multiple, separated by

The second project that requires remote backup can be multiple, but must be in a consistent format
[Backup2]
Path =/home/allsystembackup/backup2
Comment = Backup Server2
UID = root
GID = root
Read Only = no
Auth users = Backupuser2
Secrets file =/etc/rsync.pass
Hosts allow 111.111.111.111; allow my client-side host to back up to this directory

...


Again, set the password file and add the user:
#vi/etc/rsync.pass
Format:
User name: password
; Username:password
Backupuser1:090909.bac.u1
Backupuser2:953a.fa.ij3
...


Change the primary configuration file and password file permission is 600, otherwise rsync will not be able to read, I was here to make a very depressing, wasted a lot of time.
#chmod 600/etc/rsyncd.conf
#chmod 600/etc/rsync.pass


To create a backup directory:
#mkdir/home/allsystembackup
#mkdir/home/allsystembackup/backup1
#mkdir/home/allsystembackup/backup2

Finally, start rsync:
#/etc/init.d/rsync Start


Two, client settings:

First, install the Rsync software:
#apt-get Install rsync

To edit the password file that holds the client:
#vi/etc/rsync.pass, or it can be another name, which can be specified when the command is backed up
The format of this file is only one password:
953a.fa.ij3; Backupuser2 's password

To change permissions:
#chmod 600/etc/rsync.pass; Be sure to do this, or you will make an error, because there is not enough permission to read the file, then you cannot verify the

Instructions for starting a backup:
/usr/bin/rsync-avzp--delete--password-file=/etc/rsync.pass/etc backupuser2@222.222.222.222::backup2

To complete the backup, you can then look at the server-side log files.

If you want to back up multiple directories for this client host, you can write to a shell script, and then use the crontab to execute it regularly to do a regular backup, the client's rsync command to use a lot of time to continue in-depth study ...


Finish...







----------------------------------------------------------------------------------------------------------
Reference Articles:
http://community.itbbs.cn/showthread.php?t=7395

The first thing to do is install rsync software, as usual, Debian installation software is the simplest:
Aptitude Install Rsync
After installation, the default rsync is turned off. You need to open it in the/etc/default/rsync file. This file is a Debian-specific setting that controls whether Rsync runs in the service mode, and configures the service port already IP address, only on the server side (192.168.11.24) on the line, the client does not open.
Only need to open this service on the VPN address 192.168.11.24, the port does not use the default,/etc/defaule/rsync file is as follows:
Rsync_enable=true
# rsync_config_file=
rsync_opts= '--address=123.45.67.89--port=10001 '

Then configure the/etc/rsyncd.conf on the 192.168.11.24 machine, set up the Rsync Services directory provided, and which IP can access the local account number for the remote user.
[Home]
Path =/home
Comment = home directory
Use Chroot = True
UID = 0
GID = 0
Host Allow 192.168.11.2

There are password settings file/etc/rsync.pass, 2 machines should have this file. The contents are as follows:
Username:password

This, the setup is complete. Run rsync services in 192.168.11.24.
/etc/init.d/rsync start

You can then run the following script file in 192.168.11.2 to synchronize. You can put this script in the/etc/crontab and let it operate on a regular basis.
#!/bin/bash
rsync--progress--recursive--links--hard-links--times--verbose/
--compress--delete/rsync://username@192.168.11.24:10001/home/home1/192.168.11.24/home/--password-file=/etc/ Rsync.pass

Rsync can compress the transmission, if in the local area network synchronizes, may remove the--compress to turn off the compression function




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.