Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

Data synchronization between Windows and Linux across computer rooms

2025-03-01 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Servers >

Share

Shulou(Shulou.com)06/02 Report--

Background:

The headquarters R & D center needs to synchronize some files in the storage SMB service of the computer room to the IDC and the internal SMB of the branch R & D center office area. IDC and the R & D center of the headquarters form a tunnel link through IPsec × ×; the office area of the branch is only the basic network.

Difficulties:

Office area has no hardware × × equipment, no fixed IP

The firewall of the headquarters provides only 1.00 Linux version of the × × client, which requires graphics and is extremely difficult to use.

Solution:

Add the front machine to install the windows version of the software in the office area to connect with the front computer of the headquarters.

The network connection topology is as follows:

The application and implementation topology and steps are as follows:

Implement step 1:

Configure SMB in both places

The headquarters samba server installs NFS (or follows SMB), and the branch configures the SMB server.

Mount the relevant path disks to the respective front machines in the two office areas.

Implement step 2:

Through the way of IPSec × ×, the front of the headquarters is connected with the front strategy of IDC.

Rsync the folder on the front machine where SMB has been mounted to the relevant directory of the IDC hosting server

Implement step 3:

Realizing data synchronization between Windows and Linux across computer rooms

This article focuses on the relevant details of implementing step 3.

Main points:

The branch has no fixed IP and adopts the "PULL" mode to synchronize the data files to the front computer of the branch through rsync.

Required software:

Firewall comes with Windows version × × client.

CwRsync_5.5.0_x86_Free.zip

(download address: https://www.itefix.net/dl/cwRsync_5.5.0_x86_Free.zip)

As we all know, rsync relies on ssh to log in, and the difficulty of Windows version of rsync lies in how to realize automatic login without password.

The creation of / home directory under the Windows corresponding to the difficult 1:ssh

Add environment variables:

System variable

New path

C:\ cwRsync_5.5.0_x86_Free\ bin

User variable

New CWRSYNCHOME

C:\ cwRsync_5.5.0_x86_Free\ bin

After completion, you need to create / home/Administrator/.ssh through the command line

.ssh must be created through the command line

Execute in cmd

SET CWRSYNCHOME=C:\ cwRsync_5.5.0_x86_Free MKDIR% CWRSYNCHOME%\ home\% USERNAME%\ .ssh

Difficult 2:keygen permission problem

Execute in cmd

Ssh-keygen-t rsa-C Administrator@IP

Enter all the way, no password.

Send the obtained public key to the front Linux server of the headquarters

Import the public key of the front computer of the branch

Cat id_rsa.pub > > ~ / .ssh/authorized_keys chmod 6000.ssh / authorized_keys

The password is still required after the public key is issued. The error is as follows:

@ WARNING: UNPROTECTED PRIVATE KEY filings. @ @ @

This error is due to the fact that the id_rsa id_rsa.pub and konw_hosts permissions generated under Windows are not 600

So change the file properties to the following

After modification, it is as follows:

Execute the following script to synchronize:

@ ECHO OFFSET CWRSYNCHOME=C:\ cwRsync_5.5.0_x86_FreeIF NOT EXIST% CWRSYNCHOME%\ home\% USERNAME%\ .ssh MKDIR% CWRSYNCHOME%\ home\% USERNAME%\ .sshSET CWOLDPATH=%PATH%SET PATH=%CWRSYNCHOME%\ bin;%PATH%rsync-vzrtopg-- progress-- delete backup@ headquarters front machine IP:/home/share/ / cygdrive/e/

By setting the task schedule, you can achieve automatic timing synchronization.

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Servers

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report