Download

Full Tutorial: How to Make SSH PuTTY Keep Alive

This post primarily gives a full tutorial on how to make SSH PuTTY keep alive. If you want to make PuTTY SSH connection never to timeout when user is idle, keep reading!

By @Ellie Last Updated December 13, 2024

How do I keep my PuTTY session alive always?

 

Hello. I have a server I bought, if I connect with PuTTY using SSH and one user PuTTY gets disconnected by the server after some time if I am idle. How do I configure my server and how to keep PuTTY session alive indefinitely?”

- Question from Reddit

How to make SSH PuTTY keep alive on Windows

The PuTTY application is used by Microsoft Windows operating systems to establish SSH connections. You can change PuTTY's settings to assist maintain connections if you have trouble connecting. See how to make SSH PuTTY keep alive on Windows by following these instructions.

Step 1. Start PuTTY and load your connection session.

Step 2. In the Category pane, click Connection. Find Seconds between keepalives, type 30 in the box.

Note: That means it sends a "ping" every 30 seconds to prevent the connection from timing out and keep PuTTY session alive.

Step 3. In the Category pane, click Session, and then click Save.

Step 4. Connect to your account and monitor the connection, to see if the problem got fixed.

Bonus tip: How to keep SSH connections alive on Linux and macOS

If you are using Linux or macOS and wish to keep SSH connections alive, the /.ssh/config file allows you to define numerous SSH parameters, including those that keep an SSH connection alive.

Step 1. Use your preferred text editor to open the ~/.ssh/config file on your local computer. If the .ssh directory or the config file do not exist, create it.

On Linux, you can hit CTRL + ALT + T or go to the apps menu and search for “terminal” to open the Terminal.

On macOS, you can go to Finder > Applications > Utilities > Terminal to open a terminal window.

Step 2. Insert the following lines into the configuration file. The Host value can be given any name; it is essentially a label for the other parameters. The remote host you wish to connect to is specified by the Hostname parameter; replace "example.com" with your domain name. Replace "username" with the username from your A2 Hosting account:

Host example

        Hostname example.com

        Port 7822

        User username

        ServerAliveInterval 30

        ServerAliveCountMax 2

Note: In this arrangement, the SSH client maintains the connection by sending a packet to the server every 30 seconds. The connection is cut off if the client does not get a response after two attempts (as determined by the ServerAliveCountMax parameter).

Step 3. Save the changes to the config file, and then connect to your account using ssh username@ssh.server.com command.

Note: Username should be replaced with your SSH server username and ssh.server.com should be replaced with the hostname or IP address of the SSH server.

AnyViewer: Offer continuous and persistent remote session

Another way to remote into a computer is to use the free remote desktop software AnyViewer, which offers you continuous and persistent remote connections. Besides, it has the following advantages:

✍ Advantages Quick installation. Fast connection speed. One-click for unattended remote access.  Text chat available in the remote session. File transfer support. Shortcuts of essential apps like Task Manager.  Support controlling multiple computers at the same time. Mobile support is for both iOS and Android devices.

Now, download the free remote access software - AnyViewr, and walk through how it works.

Download Freeware Win PCs &  Servers
Secure Download

Step 1. Install and launch AnyViewer on both computers. Go to Log in, and then click Sign up. (If you already have signed up on its official website, you can log in directly.)

Step 2. Fill in the signup information and click Sign up to create an AnyViewer account. 

Step 3. Then you can see you successfully logged in to AnyViewer. Your device will automatically be assigned to the account you've logged in to.

Step 4. Log in to the same AnyViewer account on the two computers. Then you can achieve a one-click connection by clicking One-click control after going to Device and clicking the computer that you want to access. 

Notes:✎...
It is recommended to upgrade your account to a Professional or Enterprise plan. What can a professional or enterprise plan brings to you:
More devices can be assigned to the same account for unattended remote support.
Connect in privacy mode to protect your privacy. This means the Controller can black out the remote PC screen and disable the remote keyboard and mouse click.
File transfer speed will be increased. Transfer speed is 500 KB/s for a free account and up to 10 MB/s for a paid account.

 

Closing words

This post primarily introduces how to make SSH PuTTY keep alive on Windows. As a bonus tip, it also introduces how to keep SSH connections alive on Linux and macOS operating systems. But if you want stable and continuous remote connections, it is highly recommended to use AnyViewer.