Rsync data synchronization using detailed _linux

Source: Internet
Author: User
Tags auth ssh rsync
Rsync (d) service-side startup two ways
1.daemon 2.xinetd inetd
Bind to tcp/873 port after boot

% Cat/etc/xinetd.d/rsync
# Default:off
# description:the Rsync server is a good addition to a FTP server, as it \
# allows CRC Checksumming etc.
Service rsync
{
Disable = no
Socket_type = Stream
wait = no
user = root
Server =/usr/bin/rsync
Server_args =--daemon
Log_on_failure + + USERID
}

Configuration note Setting read and Write permissions owner
% cat/etc/rsyncd.conf

MOTD file =/var/log/rsync/welcome.msg
PID file =/var/log/rsync/rsyncd.pid
Lock file =/var/log/rsync/rsync.lock
Log file =/var/log/rsync/rsyncd.log

[Rsyncwww]
Comment = rsync www
Path =/var/www/
Use chroot = no
Max connections = 4
Read Only = False
List = True
UID = nobody
GID = Nobody
Auth users = Wwwuser
Secrets file =/etc/rsyncd.secrets
Hosts allow = 1.1.1.1,2.2.2.2
Hosts Deny = 0.0.0.0/0
Ignore errors = yes
Transfer logging = yes
Log format = "%a%f%l"
#log format = "%o%h [%a]%m (%u)%f%l"

[Rsyncroot]
Comment = rsync root
Path =/
Use chroot = no
Max connections = 4
Read Only = True
#read only = False
List = True
UID = root
GID = root
Auth users = Rootuser
Secrets file =/etc/rsyncd.secrets
Hosts allow = 1.1.1.1,2.2.2.2
Hosts Deny = 0.0.0.0/0
Ignore errors = yes
Transfer logging = yes
Log format = "%a%f%l"


Rsyncd.secrets one-line user name: password format

Use
Rsync-auvpz--progress Dir1 Dir2
RSYNC-ZTRUVOGLPD--progress Dir1 Dir2
RSYNC-ZTRUVOGLPD--progress Dir1/dir2
RSYNC-ZTRUVOGLPD--progress Dir1/file1 Dir2
If you do not want to include a directory/file, you can set--exclude

Remote use
Rsync 1.1.1.1:: List only
Rsync user@1.1.1.1::
Rsync User@1.1.1.1::module
Rsync User@1.1.1.1::module/path
If you do not configure Rsync server, you can use the SSH method
RSYNC-E Ssh-auvpz 1.1.1.1:/etc./

Attention/FINAL issue when synchronizing
Do not put/The directory name also contains mirror
Put/Then only the contents of the things mirror

RSYNC-ZTRUVOGLP--progress User@1.1.1.1::module/path./
For script invocation convenience also call--password-file same attention to the owner permission
You can also set the environment variable rsync_password= Access user-authenticated rsync

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.