When working on your server through SSH, you may sometimes experience dropped or unresponsive connections. This usually happens because firewalls or network devices close idle connections after a period of inactivity. To prevent this, you can configure your SSH client to send periodic keepalive signals.
Why Connections Drop
-
Some firewalls automatically close idle sessions.
-
Network devices may time out long-lived connections.
-
By default, SSH does not always send keepalive packets.
The result is that your SSH session may disconnect unexpectedly if left idle.
Solutions by Operating System
Windows (PuTTY)
If you use PuTTY to connect to your Ruachost server:
-
Open PuTTY.
-
Load your saved session.
-
In the left-hand Category pane, click Connection.
-
Under Sending of null packets to keep session active, set Seconds between keepalives to
240.-
This sends a keepalive packet every 4 minutes.
-
-
Go back to Session, click Save to update your profile.
-
Reconnect and monitor stability.
-
If the connection still drops, try lowering the interval (e.g., 120 seconds).
-
Linux and macOS (OpenSSH Client)
On Linux and macOS, you can configure keepalive settings in your SSH client configuration file.
Open or create the SSH config file:
Bash
nano ~/.ssh/config
Bash
Host yourdomain
Hostname yourdomain.com
Port 22
User yourusername
ServerAliveInterval 240
ServerAliveCountMax 2
-
-
Replace
yourdomain.comwith your domain or server IP. -
Replace
yourusernamewith your Ruachost account username. -
If your server uses a custom SSH port (e.g., 7822), update the
Portvalue.
-
-
Save and exit.
-
Connect using:
Bash yourdomainWith this configuration:
-
The client sends a keepalive packet every 240 seconds.
-
If no response is received after 2 attempts, the connection closes gracefully.
-