Remote backup from Linux to Windows using rsync (photos)

Source: Internet
Author: User
Article Title: remote backup from Linux to Windows using rsync (group chart ). Linux is a technology channel of the IT lab in China. Includes basic categories such as desktop applications, Linux system management, kernel research, embedded systems, and open source.
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:
    
Related Article

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.