Tuesday, May 15, 2012

SSH - Prevent SSH Session Timeout

If your SSH session is being timeout (it could be your ssh server or router timeout inactive connection), this could help

SSH obtains configuration data from the following order

1. Command line (eg, ssh host -o "options")
2. User configuration file (eg, ~/.ssh/config)
3. System wide configuration file (eg, /etc/ssh_config for Mac and /etc/ssh/ssh_config for Linux)

We will be focusing on command line

In general, a command to prevent server disconnecting inactive connection is as follow

ssh username@host -o ServerAliveInterval=X

ServerAliveInterval=X where X is in seconds. This option request the client to send a message to server in every X seconds and request a respond from the server.

Example of setting interval request for 60 second

ssh username@host -o ServerAliveInterval=60

References: https://developer.apple.com/library/mac/#documentation/Darwin/Reference/ManPages/man5/ssh_config.5.html

No comments:

Post a Comment

Hadoop - How to setup a Hadoop Cluster

Below is a step-by-step guide which I had used to setup a Hadoop Cluster Scenario 3 VMs involved: 1) NameNode, ResourceManager - Host...