SSH connection persistence and reuse in Linux

Source: Internet
Author: User
Tags ssh server

SSH connection persistence and reuse in Linux

1. Maintain

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.

2. 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 very 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 for the connection and no new connections 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.

You may also like the following SSH-related articles. For details, refer:

Complete SSH service configuration and troubleshooting in Ubuntu

How to install Samba and SSH server in Ubuntu 14.04

SSH service remote access to Linux Server login is slow

How to Improve the SSH login authentication speed of Ubuntu

Enable the SSH service to allow Android phones to remotely access Ubuntu 14.04

How to add dual authentication for SSH in Linux

Configure the SFTP environment for non-SSH users in Linux

Configure and manage the SSH service on Linux

This article permanently updates the link address:

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.