Depending on the hardware and software configuration, you may experience SSH connectivity issues to make it alive. SSH is a common tool. When using SSH, the connection may get disconnected if the SSH connection is idle for some time under common configuration. For an example, some of the firewalls may automatically close connections after a certain amount of time. You can adjust your SSH client’s settings to make your SSH alive and to overcome these types of problems.
Keeping SSH alive on Windows
In Windows(Microsoft) operating systems adjust the PuTTY program to establish SSH connections. If you experience any connectivity issues, you can adjust PuTTY’s configuration to keep your SSH connections alive. Follow the below steps to accomplish the same:
- Start your PuTTY software.
- Load the connection session.
- In the Category panel, you need to click Connection.
- Under Sending of null packets to keep session active, in the Seconds between keepalives, type 240.
- Through this configuration, PuTTY sends a packet to the server every 240 seconds (4 minutes) to keep the connection alive.
- In the Category pane, click Session.
- Click Save.
- Connect to your account and monitor the connection. If it still drops, gradually decreases the keepalive interval until the connection is stable.
Linux Server systems
- On Linux Based server systems, the ~/.ssh/config file helps you to specify the client SSH settings, including the keep alive an SSH connection.
2. Use your usual text editor to open the ~/.ssh/config file on your server or localhost.
3. If the .ssh directory the mentioned config file do not exist, try to create the same.
4. Add the below lines if you create a new config file otherwise make changes as shown below in your existing config file.
Host * Protocol 2 TCPKeepAlive yes ServerAliveInterval 60
5.Save the changes to the config file and restart the sshd daemon. Now your SSH connections time will be extended.