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

Windows 7 - How to reset Windows 7 password

This is just a post of what I had found in the Internet and it works for me (See reference for the actual post). While I knew that there a...