Skip to content

Instantly share code, notes, and snippets.

@raveenb
Last active March 19, 2021 15:16
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save raveenb/3c0542439388e2c462df0f84359bbe86 to your computer and use it in GitHub Desktop.
Save raveenb/3c0542439388e2c462df0f84359bbe86 to your computer and use it in GitHub Desktop.
Avoiding SSH Connection Timeouts

SSH Connection Timeout

Client side changes (your osx/linux pc)

  1. edit /etc/ssh/ssh
  2. you will need sudo credentials and/or permissions
  3. add the following lines where appropriate
    Host *
    ServerAliveInterval 100
  1. save and close
  2. restart ssh session or client

Server side changes (linux server)

  1. edit /etc/ssh/sshd_config
  2. you will need sudo credentials and/or permissions
  3. add the following lines where appropriate or uncomment if they are already present
    ClientAliveInterval 60
    TCPKeepAlive yes
    ClientAliveCountMax 10000
  1. save and close
  2. restart ssh server service sshd restart or service ssh restart
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment