By default, rsync is installed in Ubuntu, but no configuration file is available in/etc. You can copy the sample file to/etc.
# Cp/usr/share/doc/rsync/examples/rsyncd. conf/etc
# Vi/etc/rsyncd. conf
# Sample rsyncd. conf configuration file
# GLOBAL OPTIONS
Motd file =/etc/motd # login welcome information
Log file =/var/log/rsyncd # log file
# For pid file, do not use/var/run/rsync. pid if
# You are going to run rsync out of the init. d script.
Pid file =/var/run/rsyncd. pid
Syslog facility = daemon
# Socket options =
# MODULE OPTIONS
[Rsync]
Comment = public archive
Path =/home/soft/rsync
Use chroot = yes
# Max connections = 10 # maximum number of connections
Lock file =/var/lock/rsyncd
# The default for read only is yes...
Read only = yes
List = yes
Uid = nobody
Gid = nogroup
# Exclude =
# Exclude from =
# Include =
# Include from =
# Auth users =
# Secrets file =/etc/rsyncd. secrets
Strict modes = yes
# Hosts allow =
# Hosts deny =
Ignore errors = no
Ignore nonreadable = yes
Transfer logging = no
# Log format = % t: host % h (% a) % o % f (% l bytes). Total % B bytes.
Timeout = 600
Refuse options = checksum dry-run
Dont compress = *. gz *. tgz *. zip *. z *. rpm *. deb *. iso *. bz2 *. tbz
For personal information, change path =/home/soft/rsync to your directory.
After modification, create a new file rsyncd. pass under/etc /.
# Vi/etc/rsyncd. pass
Backup: backup
: Wq
Modify rsyncd. pass permission
# Chmod 600/etc/rsyncd. pass
Now you can start rsync.
# Rsync -- daemon
After the startup is successful, you can use lsof-I: 873 to check whether the startup is normal, or you can view/var/log/rsyncd related log files.
Backup command: rsync-vzrtopg -- progress -- delete backup@172.28.156.88: rsync/cygdrive/f/
Note: cygdrive/f/a indicates the f: \ a directory.
Detailed format description:
-V,-verbose detailed mode output
-Q,-quiet simplified output mode
-C,-checksum: enable the verification switch to force file transfer verification
-A,-archive mode, indicating that the file is transmitted recursively and all file attributes are kept, equal to-rlptgoD.
-R,-recursive processes subdirectories in recursive Mode
-R,-relative uses relative path information
-B,-backup creates a backup, that is, if the object already has the same file name, rename the old file
~ Filename. You can use the-suffix option to specify different backup file prefixes.
-Backup-dir: backs up files (for example ~ Filename) is stored in the directory.
-Suffix = SUFFIX defines the backup file prefix.
-U,-update only performs updates, that is, skipping all files that already exist in DST and whose file time is later than the time to be backed up.
(Do not overwrite the updated file)
-L,-links retains soft links
-L,-copy-links: process soft links like regular files
-Copy-unsafe-links: only copies links other than the SRC path directory tree.
-Safe-links ignores links other than the SRC path directory tree.
-H,-hard-links keep hard links
-P,-perms to keep File Permissions
-O and-owner keep file owner information
-G and-group keep file group information
-D,-devices: Keep Device File Information
-T,-times preserve the file time information
-S,-sparse performs special processing on sparse files to save DST Space
-N,-dry-run which files will be transmitted
-W,-whole-file: Copy files without incremental Detection
-X,-one-file-system do not span the boundaries of the file system
-B,-block-size = SIZE indicates the block size used by the algorithm. The default value is 700 bytes.
-E,-rsh = COMMAND specifies the shell program to replace rsh
-Rsync-path = PATH: Specifies the path of the rsync command on the remote server.
-C,-cvs-exclude automatically ignores files in the same way as CVS to exclude files that do not want to be transmitted
-Existing only updates the files that already exist in DST, instead of backing up the new files.
-Delete: delete the files that are not in the SRC file in DST.
-Delete-excluded: delete Files specified by this option at the receiving end.
-Delete after the transmission is completed
-Ignore-errors is deleted when an IO error occurs in a timely manner.
-Max-delete = NUM: a maximum of NUM files can be deleted.
-Partial retains the files that are not completely transferred for any reason to accelerate subsequent re-transmission.
-Force directory deletion, even if not empty
-Numeric-ids does not match the number user and group ID with the user name and group name.
-Timeout = time ip timeout TIME, in seconds
-I,-ignore-times do not skip files with the same time and length
-Size-only: when determining whether to back up a file, you only need to check the file size, regardless of the file time.
-Modify-window = NUM: Specifies the timestamp window used to determine whether the file time is the same. The default value is 0.
-T-temp-dir = DIR: create a temporary file in DIR
-Compare-dest = DIR: compare the files in DIR to determine whether to back up data.
-P is equivalent to-partial-progress displaying the backup process
-Z,-compress compresses backup files during transmission
-Exclude = PATTERN: Specifies the file mode that does not need to be transmitted.
-Include = PATTERN specifies the file mode to be transmitted without exclusion
-Exclude-from = FILE: exclude files in the specified mode in the FILE.
-Include-from = FILE: files with the specified FILE pattern matching are not excluded.
-Version: prints version information.
-Address: bind to a specific address
-Config = FILE: specify other configuration files. The default rsyncd. conf FILE is not used.
-Port = PORT specify other rsync service ports
-Blocking-io: block IO for remote shell
-Stats indicates the transmission status of some files.
-The actual transmission process of progress during transmission
-Log-format = FORMAT: Specify the log file format.
-Password-file = FILE: Obtain the password from the FILE.
-Bwlimit = KBPS limits I/O bandwidth, KBytes per second
-H,-help display help information