SCP implementation of Linux to Windows file data backup

Source: Internet
Author: User
Tags windows download scp command

SCP implementation of Linux to Windows file data backup

We introduced the use of Curl+windows FTP for Linux to Windows data Backup, today we introduce the use of SCP service to the Linux file to Windows Backup; we all know that SCP uses the SSL protocol for data transmission, So if we use the SCP service for data transfer, we need to install Openssh-clients (Linux), and on Windows we need to download the OpenSSH for Windows tool separately. specifically see below:

We first install openssh-clients on Linux

Yum Install–y openssh-clients

If installed we will appear the following phenomenon;

650) this.width=650; "title=" image "style=" border-top:0px;border-right:0px;background-image:none;border-bottom:0 px;padding-top:0px;padding-left:0px;border-left:0px;margin:0px;padding-right:0px; "border=" 0 "alt=" image "src=" Http://s3.51cto.com/wyfs02/M02/88/02/wKiom1fnY1DwSOwwAABgVbVyxjw755.png "height=" 131 "/>

Next we need to download the Windows OpenSSH clients, install the file we will upload as an attachment

http://openssh.en.softonic.com/

We start the installation after Windows download

650) this.width=650; "title=" clip_image001 "style=" border-top:0px;border-right:0px;background-image:none; border-bottom:0px;padding-top:0px;padding-left:0px;border-left:0px;margin:0px;padding-right:0px; "border=" 0 "alt = "clip_image001" src= "Http://s3.51cto.com/wyfs02/M01/87/FE/wKioL1fnY1HC9OZhAAG_Q5lijsQ686.png" height= "484"/>

We check all by default

650) this.width=650; "title=" clip_image002 "style=" border-top:0px;border-right:0px;background-image:none; border-bottom:0px;padding-top:0px;padding-left:0px;border-left:0px;margin:0px;padding-right:0px; "border=" 0 "alt = "clip_image002" src= "Http://s3.51cto.com/wyfs02/M00/88/02/wKiom1fnY1KytbEdAAE0CbIZ9VY339.png" height= "484"/>

installation directory

650) this.width=650; "title=" clip_image003 "style=" border-top:0px;border-right:0px;background-image:none; border-bottom:0px;padding-top:0px;padding-left:0px;border-left:0px;margin:0px;padding-right:0px; "border=" 0 "alt = "clip_image003" src= "Http://s3.51cto.com/wyfs02/M02/87/FE/wKioL1fnY1SAbPePAAFkONnT9u4610.png" height= "484"/>

Warning, prompting us to configure

650) this.width=650; "title=" clip_image004 "style=" border-top:0px;border-right:0px;background-image:none; border-bottom:0px;padding-top:0px;padding-left:0px;border-left:0px;margin:0px;padding-right:0px; "border=" 0 "alt = "clip_image004" src= "Http://s3.51cto.com/wyfs02/M00/87/FE/wKioL1fnY1Whx-67AADrBsx2zPE281.png" height= "484"/> ‘

Installation Complete

650) this.width=650; "title=" clip_image005 "style=" border-top:0px;border-right:0px;background-image:none; border-bottom:0px;padding-top:0px;padding-left:0px;border-left:0px;margin:0px;padding-right:0px; "border=" 0 "alt = "clip_image005" src= "http://s3.51cto.com/wyfs02/M01/87/FE/wKioL1fnY1aDyHKDAAFRV8OVyMI729.png" height= "448"/>

We open the installation directory

650) this.width=650; "title=" clip_image006 "style=" border-top:0px;border-right:0px;background-image:none; border-bottom:0px;padding-top:0px;padding-left:0px;border-left:0px;margin:0px;padding-right:0px; "border=" 0 "alt = "clip_image006" src= "Http://s3.51cto.com/wyfs02/M00/88/02/wKiom1fnY1ejlA7hAAD_AbERwjE822.png" height= "460"/>

Entering the installation directory from the command prompt

650) this.width=650; "title=" clip_image007 "style=" border-top:0px;border-right:0px;background-image:none; border-bottom:0px;padding-top:0px;padding-left:0px;border-left:0px;margin:0px;padding-right:0px; "border=" 0 "alt = "clip_image007" src= "Http://s3.51cto.com/wyfs02/M01/88/02/wKiom1fnY1iDCRQLAADLEKsCukQ826.png" height= "302"/>

Then execute the following command

Mkgroup-l >>. \etc\group importing local group members into mkgroup-d >>. \etc\group importing group members from a domain into mkpasswd-l >>. \ETC\PASSWD importing local user members into mkpasswd-d >>. \ETC\PASSWD importing user members from a domain mkpasswd-l-u administrator >>. \etc\passwd

650) this.width=650; "title=" clip_image008 "style=" border-top:0px;border-right:0px;background-image:none; border-bottom:0px;padding-top:0px;padding-left:0px;border-left:0px;margin:0px;padding-right:0px; "border=" 0 "alt = "clip_image008" src= "Http://s3.51cto.com/wyfs02/M02/88/02/wKiom1fnY1qx55s5AAFOYNYSkT4293.png" height= "295"/>

Start service after installation; prompt error

650) this.width=650; "title=" clip_image009 "style=" border-top:0px;border-right:0px;background-image:none; border-bottom:0px;padding-top:0px;padding-left:0px;border-left:0px;margin:0px;padding-right:0px; "border=" 0 "alt = "clip_image009" src= "Http://s3.51cto.com/wyfs02/M01/87/FE/wKioL1fnY13BEyXSAAFmXWw2F9g443.png" height= "302"/>

We also started in the service, and there were errors.

650) this.width=650; "title=" clip_image010 "style=" border-top:0px;border-right:0px;background-image:none; border-bottom:0px;padding-top:0px;padding-left:0px;border-left:0px;margin:0px;padding-right:0px; "border=" 0 "alt = "clip_image010" src= "Http://s3.51cto.com/wyfs02/M00/88/02/wKiom1fnY17iVxrKAAIBNOgVOvE286.png" height= "397"/>

Because it is a 64-bit file, we need to overwrite the installation file inside, after extracting the attachment, two files will be overwritten to the bin directory.

C:\Program Files (x86) \openssh\bin<<setupssh381-20040709.zip>>

650) this.width=650; "title=" clip_image011 "style=" border-top:0px;border-right:0px;background-image:none; border-bottom:0px;padding-top:0px;padding-left:0px;border-left:0px;margin:0px;padding-right:0px; "border=" 0 "alt = "clip_image011" src= "Http://s3.51cto.com/wyfs02/M02/87/FF/wKioL1fnY2Cz7nFRAAFUYF1_H6c824.png" height= "325"/>

Overwrite if you have a hint to overwrite

650) this.width=650; "title=" clip_image012 "style=" border-top:0px;border-right:0px;background-image:none; border-bottom:0px;padding-top:0px;padding-left:0px;border-left:0px;margin:0px;padding-right:0px; "border=" 0 "alt = "clip_image012" src= "http://s3.51cto.com/wyfs02/M00/88/02/wKiom1fnY2OSANm9AAGUlxdI1FQ433.png" height= "436"/>

650) this.width=650; "title=" clip_image013 "style=" border-top:0px;border-right:0px;background-image:none; border-bottom:0px;padding-top:0px;padding-left:0px;border-left:0px;margin:0px;padding-right:0px; "border=" 0 "alt = "clip_image013" src= "Http://s3.51cto.com/wyfs02/M01/88/02/wKiom1fnY2Xx1lYZAAIE_bfio1I241.png" height= "484"/>

After overwriting, the service starts normally

650) this.width=650; "title=" clip_image014 "style=" border-top:0px;border-right:0px;background-image:none; border-bottom:0px;padding-top:0px;padding-left:0px;border-left:0px;margin:0px;padding-right:0px; "border=" 0 "alt = "clip_image014" src= "http://s3.51cto.com/wyfs02/M01/88/02/wKiom1fnY2fhJELzAABxHjIc9l0093.png" height= "231"/>

650) this.width=650; "title=" clip_image015 "style=" border-top:0px;border-right:0px;background-image:none; border-bottom:0px;padding-top:0px;padding-left:0px;border-left:0px;margin:0px;padding-right:0px; "border=" 0 "alt = "clip_image015" src= "Http://s3.51cto.com/wyfs02/M02/88/02/wKiom1fnY3Di883DAAHY6uldzCc722.png" height= "354"/>

Then open the port on the firewall

650) this.width=650; "title=" clip_image016 "style=" border-top:0px;border-right:0px;background-image:none; border-bottom:0px;padding-top:0px;padding-left:0px;border-left:0px;margin:0px;padding-right:0px; "border=" 0 "alt = "clip_image016" src= "Http://s3.51cto.com/wyfs02/M00/88/02/wKiom1fnY3Gixc6uAAESjPPtSKQ081.png" height= "470"/>

We perform a Telnet service on Linux to test

650) this.width=650; "title=" clip_image017 "style=" border-top:0px;border-right:0px;background-image:none; border-bottom:0px;padding-top:0px;padding-left:0px;border-left:0px;margin:0px;padding-right:0px; "border=" 0 "alt = "clip_image017" src= "Http://s3.51cto.com/wyfs02/M00/88/02/wKiom1fnY3KzRd5ZAAFgYY7WnlE518.png" height= "452"/>

We then use the command to try the data upload, prompting the error

650) this.width=650; "title=" clip_image018 "style=" border-top:0px;border-right:0px;background-image:none; border-bottom:0px;padding-top:0px;padding-left:0px;border-left:0px;padding-right:0px, "border=" 0 "alt=" clip_ image018 "src=" Http://s3.51cto.com/wyfs02/M01/88/02/wKiom1fnY3PijtFLAACW5EGYt5A684.png "height=" 98 "/>

Configuring key validation

Next we need to configure the key verification, because the data synchronization we can not use password authentication and then transfer the synchronization data, so we need to configure key authentication, so that the local server and remote server synchronization between the need for password authentication;

In fact, key verification of our previous article has been written, in order to facilitate this or to say. On the source server we generate a pair of authentication keys via Ssh-keygen, a public key, a private key, the private key is placed on the remote server, the private key needs the public key authentication before it can be matched, so it is relatively safe;

1ssh-keygen-t RSA Enter;

Because of the previous use of the server registered, so it is used directly, the computer name is not the same, please ignore it;

650) this.width=650; "title=" clip_image019 "style=" border-top:0px;border-right:0px;background-image:none; border-bottom:0px;padding-top:0px;padding-left:0px;border-left:0px;margin:0px;padding-right:0px; "border=" 0 "alt = "clip_image019" src= "http://s3.51cto.com/wyfs02/M02/87/FF/wKioL1fnY3TwQzcoAACHxDFV3VA222.png" height= "/>"

Create directory, authentication directory, and then return all the way.

650) this.width=650; "title=" clip_image020 "style=" border-top:0px;border-right:0px;background-image:none; border-bottom:0px;padding-top:0px;padding-left:0px;border-left:0px;margin:0px;padding-right:0px; "border=" 0 "alt = "clip_image020" src= "Http://s3.51cto.com/wyfs02/M01/88/02/wKiom1fnY3TifJQ9AAGkdwIoZ4g745.png" height= "349"/>

A pair of key files are generated in the/ROOT/.SSH directory

Id_rsa private Key

Id_rsa.pub Public Key

650) this.width=650; "title=" clip_image021 "style=" border-top:0px;border-right:0px;background-image:none; border-bottom:0px;padding-top:0px;padding-left:0px;border-left:0px;margin:0px;padding-right:0px; "border=" 0 "alt = "clip_image021" src= "http://s3.51cto.com/wyfs02/M00/87/FF/wKioL1fnY3XghvBMAABZBP2v_aE414.png" height= "/>"

We copy the public key to Windows

650) this.width=650; "title=" clip_image022 "style=" border-top:0px;border-right:0px;background-image:none; border-bottom:0px;padding-top:0px;padding-left:0px;border-left:0px;margin:0px;padding-right:0px; "border=" 0 "alt = "clip_image022" src= "Http://s3.51cto.com/wyfs02/M01/87/FF/wKioL1fnY3aAe-g3AAFGN43-fYE400.png" height= "198"/>

650) this.width=650; "title=" clip_image023 "style=" border-top:0px;border-right:0px;background-image:none; border-bottom:0px;padding-top:0px;padding-left:0px;border-left:0px;margin:0px;padding-right:0px; "border=" 0 "alt = "clip_image023" src= "Http://s3.51cto.com/wyfs02/M00/88/02/wKiom1fnY3iSD6jLAAFFwFwRn7U002.png" height= "394"/>

Import the public key into the winsshd Open easy setting–>virtual Accounts Point add button,,, Enter a name, such as Codeif, in the list 0 keys after the Edit button, import just the public key can not enter the password, Linux can get the files from the winsshd machine with the SCP command.

Note: Only commands can be used under Windows to create a folder with points ". SSH"

650) this.width=650; "title=" clip_image024 "style=" border-top:0px;border-right:0px;background-image:none; border-bottom:0px;padding-top:0px;padding-left:0px;border-left:0px;margin:0px;padding-right:0px; "border=" 0 "alt = "clip_image024" src= "Http://s3.51cto.com/wyfs02/M02/87/FF/wKioL1fnY3uQ86a3AAOiOvLVjHQ566.png" height= "484"/>

650) this.width=650; "title=" clip_image025 "style=" border-top:0px;border-right:0px;background-image:none; border-bottom:0px;padding-top:0px;padding-left:0px;border-left:0px;margin:0px;padding-right:0px; "border=" 0 "alt = "clip_image025" src= "Http://s3.51cto.com/wyfs02/M00/87/FF/wKioL1fnY3zj648gAAE3PNuvn60044.png" height= "345"/>

Copy the public key to the directory

650) this.width=650; "title=" clip_image026 "style=" border-top:0px;border-right:0px;background-image:none; border-bottom:0px;padding-top:0px;padding-left:0px;border-left:0px;margin:0px;padding-right:0px; "border=" 0 "alt = "clip_image026" src= "Http://s3.51cto.com/wyfs02/M01/88/02/wKiom1fnY33x2Y-fAABoavCF758136.png" height= "248"/>

2. Import the public key into the WINSSHD

Open Easy setting–>virtual Accounts

Click the Add button,,, enter a name, such as Codeif, in the list of 0 keys after the Edit button, import just the public key can not enter the password, Linux can use the SCP command from the machine containing winsshd to get files

http://blog.csdn.net/acanoe/article/details/7868499

650) this.width=650; "title=" clip_image027 "style=" border-top:0px;border-right:0px;background-image:none; border-bottom:0px;padding-top:0px;padding-left:0px;border-left:0px;margin:0px;padding-right:0px; "border=" 0 "alt = "clip_image027" src= "http://s3.51cto.com/wyfs02/M02/88/02/wKiom1fnY36Q1pUQAAI-uAWtg_s560.png" height= "/>"

net stop opensshdnet start opensshd

We'll start by copying a file from the window to Linux.

We have to execute the command must be in the OpenSSH directory, or we will prompt the SCP does not have this command, we can also add the road to the environment variable, so that we can arbitrarily execute the command

C:\Program Files (x86) \openssh\bin>scp.exe xxxx.txt [email protected]:/root

650) this.width=650; "title=" clip_image028 "style=" border-top:0px;border-right:0px;background-image:none; border-bottom:0px;padding-top:0px;padding-left:0px;border-left:0px;margin:0px;padding-right:0px; "border=" 0 "alt = "clip_image028" src= "Http://s3.51cto.com/wyfs02/M00/87/FF/wKioL1fnY4CgyDUZAAFBS9sC7WU607.png" height= "175"/>

We found a sh.exe file in Linux.

650) this.width=650; "title=" clip_image029 "style=" border-top:0px;border-right:0px;background-image:none; border-bottom:0px;padding-top:0px;padding-left:0px;border-left:0px;margin:0px;padding-right:0px; "border=" 0 "alt = "clip_image029" src= "http://s3.51cto.com/wyfs02/M02/88/02/wKiom1fnY4GzydkVAAA6K_sYQds657.png" height= "/>"

We can also use SCP commands on Windows to copy files from Linux to Windows Local

Next we test the copy file from Linux to the specified directory in Windows

This execution is transferred to the default path, and the installation defaults to C:\Program Files (x86) \openssh

scp/root/1.txt [email protected]:

650) this.width=650; "title=" clip_image030 "style=" border-top:0px;border-right:0px;background-image:none; border-bottom:0px;padding-top:0px;padding-left:0px;border-left:0px;margin:0px;padding-right:0px; "border=" 0 "alt = "clip_image030" src= "http://s3.51cto.com/wyfs02/M00/88/02/wKiom1fnY4LBoborAAERtWOYQdI269.png" height= "/>"

650) this.width=650; "title=" clip_image031 "style=" border-top:0px;border-right:0px;background-image:none; border-bottom:0px;padding-top:0px;padding-left:0px;border-left:0px;margin:0px;padding-right:0px; "border=" 0 "alt = "clip_image031" src= "Http://s3.51cto.com/wyfs02/M02/87/FF/wKioL1fnY4aBr2cgAAExAklyHTM655.png" height= "344"/>

SCP 1.txt [email protected]:d:/data/

650) this.width=650; "title=" clip_image032 "style=" border-top:0px;border-right:0px;background-image:none; border-bottom:0px;padding-top:0px;padding-left:0px;border-left:0px;margin:0px;padding-right:0px; "border=" 0 "alt = "clip_image032" src= "Http://s3.51cto.com/wyfs02/M01/88/02/wKiom1fnY4qRNtlHAAFVbMw2g2w022.png" height= "248"/>

Or use--suggest using the format cygdrive format SCP 1.sh [email protected]:/cygdrive/d/data/such as need to copy to Windows directory D:\test\data\---> We need to change the command format/cygdrive/d/test/data/a lot less error hints

650) this.width=650; "title=" clip_image033 "style=" border-top:0px;border-right:0px;background-image:none; border-bottom:0px;padding-top:0px;padding-left:0px;border-left:0px;margin:0px;padding-right:0px; "border=" 0 "alt = "clip_image033" src= "Http://s3.51cto.com/wyfs02/M01/87/FF/wKioL1fnY4uw2XojAACsTSCCr3A909.png" height= "143"/>

650) this.width=650; "title=" clip_image034 "style=" border-top:0px;border-right:0px;background-image:none; border-bottom:0px;padding-top:0px;padding-left:0px;border-left:0px;margin:0px;padding-right:0px; "border=" 0 "alt = "clip_image034" src= "http://s3.51cto.com/wyfs02/M02/88/02/wKiom1fnY4zS2jxKAABt7eQE3C4297.png" height= "251"/>

Execute on Linux

650) this.width=650; "title=" clip_image035 "style=" border-top:0px;border-right:0px;background-image:none; border-bottom:0px;padding-top:0px;padding-left:0px;border-left:0px;margin:0px;padding-right:0px; "border=" 0 "alt = "clip_image035" src= "Http://s3.51cto.com/wyfs02/M02/88/02/wKiom1fnY46TVF8cAAFlvHdO7Co423.png" height= "280"/>

This article from "Gao Wenrong" blog, declined reprint!

SCP implementation of Linux to Windows file data backup

Related Article

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.