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, and create it if not), 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.