[Data synchronization] Linux synchronizes data with Windows

Source: Internet
Author: User
Tags rsync

Experimental environment

Service side: Linux Centos 6.8 (10.208.131.198)

Client:windows (10.208.131.199)

Service side

First, installing rsync Service Setup boot from

# yum Install xinetd rsync-y# chkconfig xinetd on# chkconfig rsync on



second, set up rsync to operate as a service mode

 # vim /etc/xinetd.d/rsyncservice rsync{         disable = no             (default = yes)          flags            = ipv6        socket_type     =  stream        wait             = no        user             = root         server          = /usr/bin/rsync         server_args     = --daemon         log_on_failure  += userid} 


Third, start the rsync service to see if the port is open

# service xinetd start# netstat-tanp |grep 873tcp 0 0::: 873:::* LISTEN 1593/xinetd

iv. configuration rsyncd.conf ( manual creation required)

# vim/etc/rsyncd.confuid = root//user gid running rsync daemon = root//The group running the rsync daemon is use chroot = nopid File =/var/run/rsyncd.pid//pi d file storage location lock file =/var/run/rsync.lock//lock files storage location log file =/var/log/rsyncd.log//log files storage location max connections = 3// Maximum client connections 3stirict modes = yes//whether to check password permissions port = 873//rsync default port [testshare]//authenticated module name in the client needs to specify PATH =/share///Directory participating in synchronization ignore errors//can ignore some unrelated IO errors Read Only = no//allows readable writable list = no//does not allow listing of hosts allow = 10.208.131.1.199//allows synchronous hosts to deny everything else auth users = ad min//authenticated user name secrets file =/etc/rsyncd.pass//password files storage address


V. Create a directory for data synchronization

# Mkdir/share


Vi. Create a user name and password to give permission and restart the rsync service

# vim/etc/rsyncd.passadmin:123456//format user:passwd for line # chmod 600/etc/rsyncd.pass# chown ROOT.ROOT/ETC/RSYNCD.PA ss# Service xinetd Restart

Client

First, Windows host client Installation and configuration

Https://www.itefix.net/cwrsync (5.5 version) Green Edition

5.5 Version Direct decompression under the cmd command line switch to the bin can be used

5.5 version needs to add an account for itself

4.0.5 has a server and client version

4.0.5 Client version No chmod and chown These two commands need to be copied from the server

5.5 Service End is chargeable

5.5 of clients have chmod and chown programs.


650) this.width=650; "src=" Https://s3.51cto.com/wyfs02/M02/07/43/wKiom1nGJnWQ040HAAA994K_Hts042.png "title=" Picture 1.png "alt=" Wkiom1ngjnwq040haaa994k_hts042.png "/>


Server and client accounts and passwords must be created consistently account admin password 123456


650) this.width=650; "src=" Https://s3.51cto.com/wyfs02/M02/A5/F4/wKioL1nGJk3QmQsLAABIYqE6p8Q878.png "style=" float : none; "title=" Image 2.png "alt=" Wkiol1ngjk3qmqslaabiyqe6p8q878.png "/>

650) this.width=650; "src=" Https://s2.51cto.com/wyfs02/M01/A5/F4/wKioL1nGJqDQOYS_AAAcq-n_e94507.png "title=" The frog starved to death if rebound can _20170923171634.png "alt=" Wkiol1ngjqdqoys_aaacq-n_e94507.png "/>


Create a sync password do not require an account only need a password

Create a new text document rename the password to Rsyncd.pass after it is written


650) this.width=650; "src=" Https://s5.51cto.com/wyfs02/M02/A5/F4/wKioL1nGJs7wYu6aAAAPyuy-XD8704.png "title=" Picture 4.png "alt=" Wkiol1ngjs7wyu6aaaapyuy-xd8704.png "/>


Password files can be synchronized at any time to specify the password file location is good

To set the password file permissions

C:\users\administrator>d:d:\>cd/icw/bin/d:\icw\bin>chmod.exe-c 600/cygdrive/d/icw/rsyncd.passmode of '/ Cygdrive/d/icw/rsyncd.pass ' changed to 0600 (rw-------) D:\icw\bin>chown.exe administrator/cygdrive/d/icw/ Rsyncd.pass


environment variable Settings

Computer Properties -- Advanced system settings -- environment variables-- system Variables ----Path--and end add D:\ICW\Bin;


%systemroot%\system32;%systemroot%;%systemroot%\system32\wbem ;D: \icw\bin;

Turn off cmd command line re-open input rsync Enter will come out rsync 's help information is already in effect

Test whether synchronization is possible

Create a file in the Linux Sync directory and create the share directory on the Windows E Disk

C:\USERS\ADMINISTRATOR>RSYNC-VZRTOPG--progress [Email protected]::testshare/cygdrive/e/share--password-file=/ CYGDRIVE/D/ICW/RSYNCD.PASS-V verbose mode output-Z,--compress compresses the backed-up files as they are transmitted. -R,--recursive subdirectories are processed in recursive mode. -T,--times keeps file time information. -O,--owner keep the file owner information. -P,--perms maintain file permissions. -G,--group keep the file group information. --delete Delete a file or directory that does not have a source file in the destination--progress displays the backup process. /cygdrive/e/share e under the share/cygdrive/must add the--password-file=rsyncd.pass from Rsyncd.pass get the password

Scheduled Tasks

Because the environment variable is set to write the command above directly to the text document, rename the. bat or NaNd file to the Task Scheduler.

Test results


650) this.width=650; "src=" Https://s4.51cto.com/wyfs02/M00/A5/F5/wKioL1nGKL3h5YZaAAAKrO6s_rY462.png "style=" float : none; "title=" Image 5.png "alt=" Wkiol1ngkl3h5yzaaaakro6s_ry462.png "/>


650) this.width=650; "src=" Https://s4.51cto.com/wyfs02/M02/07/44/wKiom1nGKPazKlv1AAB15MDigSM245.png "style=" float : none; "title=" Image 6.png "alt=" Wkiom1ngkpazklv1aab15mdigsm245.png "/>

650) this.width=650; "src=" Https://s3.51cto.com/wyfs02/M01/A5/F5/wKioL1nGKTuh3JGiAAB15MDigSM691.png "title=" Picture 7.png "alt=" Wkiol1ngktuh3jgiaab15mdigsm691.png "/>


650) this.width=650; "src=" Https://s4.51cto.com/wyfs02/M00/A5/F5/wKioL1nGKL2S4F0nAAAjUE1zta8075.png "style=" float : none; "title=" Image 8.png "alt=" Wkiol1ngkl2s4f0naaajue1zta8075.png "/>




This article is from the "Peng Wu blog" blog, make sure to keep this source http://sedlock.blog.51cto.com/3030387/1968018

[Data synchronization] Linux synchronizes data with Windows

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.