Implement SCP and SSH proxy connection

Source: Internet
Author: User

In daily O & M work, you often have the following operations: log on to the central control (level 1) ---> log on to the overseas central control (level 2) ----> log on to the game server (level 3 ).

This operation is very complicated, especially when transferring files to the target server, it is slightly difficult to manage. The central control server that logs on to the target server will squeeze out various temporary files, making the file distribution in the system messy. So, is there a way to log on directly from the first-level server to the third-level server or upload files? The first method we came up with was to configure a network proxy or write a script. The script uploads the file to the second-level server, and then uploads the file to the third-level server through session. Then, the second-level Server File Cache is deleted. In fact, ssh and SCP commands can be configured as proxy connections through their own parameters, mainly using the SSH proxycommand parameter, the parameter value format is "ssh second-level Server ip nc % H % P". We can see that the NC command is used internally to forward packets between the first-level and third-level servers. Note:SSH key trust needs to be adjusted. Because of the proxy, the third-level server receives requests from the first-level server. Therefore, you need to configure the public key of the first-level server to the authorized_keys file of the third-level server. Configuration instance:
    1. Server IP Address:
      1. Level 1 server: 10.34.10.10
      2. Secondary server: 10.34.11.11
      3. Level 3 server: 10.34.12.12
    2. Key Trust Relationship: 11 trust 10; 12 trust 11; 12 trust 10
    3. Implementation: log on to the first-level server and log on to the third-level server through SSH or SCP.
    4. Copy Data:
      SCP-O proxycommand = "ssh 10.34.11.11 NC % H % P"./testfile.txt 10.34.12.12:/root/
    5. Login Server:
      Ssh-O proxycommand = "ssh 10.34.11.11 NC % H % P" 10.34.12.12

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.