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: