InfoHeap
Tech
Navigation
  • Home
  • Tutorials
    • CSS tutorials & examples
    • CSS properties
    • Javascript cookbook
    • Linux/Unix Command Line
    • Mac
    • PHP
      • PHP functions online
      • PHP regex
    • WordPress
  • Online Tools
    • Text utilities
    • Online Lint Tools
search

Ssh tutorials

  • Create ssh public/private keys on command line
  • Check if an ssh key has passphrase
  • Connect to mysql server using ssh port forwarding
  • Display keys added to ssh-agent using ssh-add
  • Find authentication methods an ssh server supports
  • Generate ssh public key from private key
  • Linux - how to enable password login on ssh server
  • Linux - ssh agent forwarding when using bastion host
  • Prevent ssh session freezing due to timeout
  • Remove passphrase from ssh private key
  • Ssh port forwarding to surf a site from different location
 
  • Home
  • > Tutorials
  • > Linux/Unix Command Line
  • > SSH

How to prevent ssh session freezing due to timeout

By admin on Nov 21, 2015

It can be quite annoying to kill a frozen ssh session and the restart it. This can happen if you leave an ssh shell idle for too long. Your context and history is also lost on the target machine. Here are quick steps to prevent ssh disconnection due to timeout.

Using ServerAliveInterval in .ssh/config

Open ~/.ssh/config file and add the following line in the beginning:

ServerAliveInterval 100

This will send a null packet to server in case client is idle. Note that we can set ServerAliveInterval for a specific host also as shown below:

Host host1.com
ServerAliveInterval 100

Using ServerAliveInterval option on command line

We can also set ServerAliveInterval on command line. Here is how you can set it:

ssh -o ServerAliveInterval=100 -l user1 server.com

Suggested posts:

  1. Apache – add basic auth to a location or directory
  2. Memcache – how to dump all keys and values on command line
  3. How to zip/unzip a directory with password
  4. Java – array for-each loop
  5. How to log page latency and url host in apache log
  6. How to find python package’s file location
  7. Custom terminal tab title and ssh on mac
  8. How to connect to mysql server using ssh port forwarding
Share this article: share on facebook share on linkedin tweet this submit to reddit
Posted in Tutorials | Tagged Linux, Linux/Unix Command Line, Mac, SSH, Tutorials, Ubuntu Linux
  • Browse content
  • Article Topics
  • Article archives
  • Contact Us
Popular Topics: Android Development | AngularJS | Apache | AWS and EC2 | Bash shell scripting | Chrome developer tools | Company results | CSS | CSS cookbook | CSS properties | CSS Pseudo Classes | CSS selectors | CSS3 | CSS3 flexbox | Devops | Git | HTML | HTML5 | Java | Javascript | Javascript cookbook | Javascript DOM | jQuery | Kubernetes | Linux | Linux/Unix Command Line | Mac | Mac Command Line | Mysql | Networking | Node.js | Online Tools | PHP | PHP cookbook | PHP Regex | Python | Python array | Python cookbook | SEO | Site Performance | SSH | Ubuntu Linux | Web Development | Webmaster | Wordpress | Wordpress customization | Wordpress How To | Wordpress Mysql Queries | InfoHeap Money

Copyright © 2025 InfoHeap.

Powered by WordPress