Remote backup from Linux to Windows using rsync

Source: Internet
Author: User

Rsync is a data image backup tool in Linux. It can be seen from the software name-Remote Sync. Rsync supports most UNIX-like systems, including Linux, Solaris, and BSD. The latest version of rsync can be found at http://rsync.samba.org/rsync. Its features are as follows:
  
1. images can be used to save the entire directory tree and file system.
  
2. It is easy to maintain the permissions, time, and soft links of the original file.
  
3. installation without special permissions.
  
4. optimized process, high file transmission efficiency.
  
5. You can use RCP, ssh, and other methods to transmit files. Of course, you can also use a direct socket connection.
  
This article describes how to use rsync to perform remote backup from Linux to Windows.
  
  1. Configure the server
  
First, we need to configure rsync, open the configuration file/etc/xinetd. d/rsyncd. conf (if not, create it), modify the configuration items, and add the following content:
  
Uid = Nobody # ID of the backup, user ID
Gid = Nobody # ID of the backup, group ID
  
# Note that this user ID and group ID can be set to root for convenience, so rsync can almost # Read any files and directories, but it also brings security risks. We recommend that you set it to read data only.
  
# Copies of directories and files.
Max connections = 4 # the maximum number of connections is 4
  
[Www] # specify the name of the authenticated backup module
Path =/WWW # directory to be backed up
Comment = backup WWW # comment
Ignore errors # ignore unrelated Io errors
Read Only = yes # Set to read-only
List = No # column Files Not Allowed
Auth users = wwwuser # The authenticated user name. If this line is not displayed, it indicates that it is anonymous.
Hosts allow = 220.122.133.31 # IP address of the host that allows connection to the server
Secrets file =/etc/wwwuser. pass # authentication file name, used to store the password
  
This section is modified.
  
Note: If you need to back up other directories at the same time, you can directly add the configuration content after the configuration file, for example:
  
[Database]
Path =/var/lib/MySQL
......
  
In this way, you can back up multiple directories at the same time.
  
Then, set the password file for the backup module. In the above example, the password file is/etc/wwwuser. Pass. Use the editor to create this file and enter the user name and password:
VI/etc/wwwuser. Pass
  
Enter the following content:
Wwwuser: 123456
  
In this way, a password of 123456 is set for the wwwuser of the backup module www. Note: For security purposes, the attributes of this file must be read only by the owner; otherwise, rsync will refuse to run. We can set its property to 600:
Chmod 600/etc/wwwuser. Pass
  
Set the rsync service to automatically start running when the system starts. You can set it through ntsysv:
  

 

Finally, we need to start the rsync service on the server:
Service xinetd restart
  
Now, the server configuration is complete.
  
  Ii. Configure the client
  
To use rsync in windows, we need to download the cwrsync tool, which is an rsync for Windows version.
  
The directory structure after the download and installation is similar to the following:
  

 

Now we can run rsync in windows. For example, use the following command to connect to the server and start backing up directories and files:
Rsync-vzrtopg -- Progress -- delete wwwuser@xx.xx.xx.xx: www. \ Bak
We can see that:
Password:
  
A prompt asking you to enter the password should be displayed after you enter the password correctly. Of course, the following error message may also appear:
  

 

There are several possibilities for this error. One is that you did not enter the correct user name or password, and the other is that the file storing the password on your server does not have the correct permission, that is, your password file is not like this permission:-RW ------- 1 Root
  
After the backup is complete, we can see a similar status:
  

 

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.