Skip to content

Instantly share code, notes, and snippets.

@kat47
Last active March 14, 2021 09:35
Show Gist options
  • Save kat47/c6e68a953c1076340294ced871895e63 to your computer and use it in GitHub Desktop.
Save kat47/c6e68a953c1076340294ced871895e63 to your computer and use it in GitHub Desktop.
SSH Keep Alive

How to prevent SSH session from disconnection too soon due to inactivity

Make use of the "ServerAliveInterval" option

ssh user@hostname -o ServerAliveInterval=300

To use by default you can create an Alias

alias sshlive='ssh -o ServerAliveInterval=300'

To connect

sshlive user@hostname

To use it is as the default option alias the ssh command

alias ssh='ssh -o ServerAliveInterval=300'

To connect

ssh user@hostname

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment