How to configure ssh connection persistence and reuse in Linux

Source: Internet
Author: User

Persistence

Using a terminal to log on to the remote development machine coding should be the work of most programmers year after year, but the tragedy is that ghost will cut off your instant chat with the beauty test, fortunately, ssh provides the ServerAliveInterval command to maintain connections. You only need to create a new file ~ /. Ssh/config and enter the following command:

ServerAliveInterval 60

In this way, ssh will send a KeepAlive request every 60 seconds to ensure that the terminal will not disconnect due to idle timeout.

Reuse

If you use a mac, it is inconvenient that you do not have the clone function. In the new window, you need to re-enter the complicated user name and password, it is a sad thing for programmers who often troubleshoot online problems. Fortunately, ssh provides the connection reuse function. The principle of this function is very simple, when you open an ssh connection to the backend and then use ssh to connect to the same remote host, ssh will directly use the socket file of the connection and no new connection will be created. Similarly, user authentication is not required. Is it very happy? You only need to create a new file ~ /. Ssh/config and enter the following command:


Host *
ControlMaster auto
ControlPath ~ /. Ssh/master-% r @ % h: % p

After saving, after logging on to the remote host through ssh on the terminal ~ /. Ssh leaves many master-username @ hostname files. The truth is self-evident.

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.