Pegasi Wiki

This wiki acts as a memo for our own work so why not share them? Feel free to browse and use out notes and leave a note while at it.

How to keep your SSH connection alive when idle


This is something I regularly need and I always Google it so better write it down here.

Sometimes you want your SSH session development session to be alive for longer idle periods and relogging loses the thought pointer slowing down work.

The solution

This is easy to achieve, just add this to your ~/.ssh/config:

Host myhost_to_connect_to
    ServerAliveInterval 60

This sends activity to the ssh session every 60 seconds and should keep your sessions active.

Also remember

Many times there is a reason to shut down idle connections, mostly due to security. Se be aware of these and do not use persistant connections in an insecure environment.

 stars  from 0 votes

Leave a comment

Enter your comment:

  //check if we are running within the DokuWiki environment if (!defined("DOKU_INC")){ die(); } //place the needed HTML source codes BELOW this line