Article Title: Rsync server configuration. 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.
1. Software Download:
The home address of rysnc is http://rsync.samba.org/. you can download the rysninstallation software from here (for Linux systems, it is best to compile and install the software using the source code)
Installation steps:
1) tar zxvf rsync-2.6.8.tar.gz
2) cd rsync-2.6.8
3)./configure? Prefix = path
4) make; make install
2. Configuration
The configuration file of the rsync server is/etc/rsyncd. conf, which controls authentication, access, and logging. This file is composed of one or more modules. A module definition starts with the module name in square brackets,
The module contains the Parameter definition in the format of name = value until the definition of the next module or the end of the file. Each module corresponds to a directory tree to be backed up.
Change the server configuration file
[Root @ winXP etc] # vi rsyncd. conf (manually generated)
Uid = nobody indicates the permission to run the service
Gid = nobody
Use chroot = no
Max connections = 4
Pid file =/var/run/rsyncd. pid specifies the log file
Lock file =/var/run/rsyncd. lock
Log file =/var/log/rsyncd. log
# Motd file =/etc/rsyncd. motd # Welcome Information
[Test]
Path =/var/test
Ignore errors
Read only = true
List = false
# Hosts allow = 192.168.3.0
# Hosts deny = 0.0.0.0/24
Uid = root
Gid = root
Auth users = love the authentication username of the synchronization Project
Secrets file =/etc/rsyncd. pwd password file of the synchronization Project
3. Change the password file
[Root @ winXP etc] # vi rsyncd. pwd
Love: love user name and password
4. Change the Password File Permission
Chmod + 600/etc/rsyncd. pwd
5. Start the rsyncd Service
/Usr/local/rsync/bin/rsync? Daemon or # rsync -- daemon
Add rc. local
Edit/etc/rc. d/rc. local and add:
/Usr/local/bin/rsync -- daemon
Rsync client Configuration
1. The rsync software package must also be installed for software installation.
2. Edit the password file
[Root @ pxe etc] # vi/etc/rsyncd. pwd
Love # note that this file only contains the password. When running on the same machine, you need to put the client password file in another directory and start
In the dynamic synchronization -- password-file, specify its path.
3. Change File Permissions
Chmod + 600/etc/rsyncd. pwd
4. Start synchronization on the client:
# Rsync? Av? Password-file = "/etc/rsync. secret" rsync @ rsync-server: sharename/source-dir dest-dir? SS
Rsync-av -- password-file =/etc/rsyncd. pwd love@192.168.16.229: test/home/test
Rsync command
1. Use rsh or ssh commands
In the absence of an rsync server, we can use the rsync command to directly perform fast differential backup:
Command Format:
# Rsync [option] Destination path of the Source Path
Where:
[Option]:
A: Use the archive mode, which is equal to-rlptgoD, that is, keep the original file permission.
Z: Indicates compressed data during transmission.
V: display to the screen
E: Use a remote shell program (rsh or ssh can be used)
-- Delete: Precisely saves copies. files deleted from the source host are also deleted from the target host.
-- Include = PATTERN: do not exclude files or directories that conform to PATTERN.
-- Exclude = PATTERN: exclude all files or directories that conform to the PATTERN.
-- Password-specifies the user verification password used for rsync server
The Source Path and target path can be in the following format:
Rsync: // [USER @] Host [: Port]/Path <-- rsync server Path
[USER @] Host: Path <-- another representation of rsync server
[USER @] Host: Path <-- remote Path
LocalPath <-- local path
※Note that at least one source or target path must be a local path. If the local path is ignored, only the remote file list is listed.
[1] [2] Next page