• Skip to primary navigation
  • Skip to content
  • Skip to primary sidebar
  • Skip to footer

GitopsCentral

  • Home
  • Courses
  • Roadmap
  • About
  • Log In
  • Sign Up

Increase SSH connection timeout

December 4, 2022 by shaik zillani

In this blog we are going to see how to increase session timeout in openssh server.

The can be done in two ways, you can either set this on server side or you can set this on client side. Let’s check both ways.

Definition

ServerAliveInterval: Number of seconds that the client will wait before sending a null packet to the server (to keep the connection alive).

ClientAliveInterval: Number of seconds that the server will wait before sending a null packet to the client (to keep the connection alive).

On Server Side

On the Server side, update client timeout. Increase Client interval in sshd_config,

vi /etc/ssh/sshd_config

Update following parameters & restart the sshd server, (set for 3600 x 2 = 2 hours)

ClientAliveInterval 3600 
ClientAliveCountMax 2

Restart sshd server,

systemctl restart sshd

On the Client side

Openssh client

If you are using openssh as client, then on the client side, increase serveralive interval in the config below,

vi /etc/ssh/ssh_config
or 
vi /root/.ssh/config

Add the below lines under the config & save

HOST *
  ServerAliveInterval 60
  ServerAliveCountMax 2

Above configuration will poke server every 60 seconds if its alive or not. Will retry 2 times.

Putty

If you are using Putty as your client, then, we need to set a time interval (60 seconds in below example) in order to keep the session alive. This will keep the session alive by poking it every 60 seconds.

linux openssh,  ssh

Primary Sidebar

en English
ar Arabiczh-CN Chinese (Simplified)nl Dutchen Englishfr Frenchde Germanhi Hindiid Indonesianit Italianja Japanesems Malaypt Portugueseru Russianes Spanishte Telugu

Course Tags

concurrency free go golang

Recent Posts

  • Roadmap to Mastery
  • Increase SSH connection timeout
  • Check Certificate expiry in Kubernetes
  • space invaders in golang
  • creating kubernetes cluster using eksctl
  • Facebook
  • GitHub
  • YouTube

Contact

Navigation

  • goacademy pro

Footer

  • Facebook
  • GitHub
  • Instagram
  • LinkedIn
  • Twitter

info@gitopscentral.com


+91 8341443220

© Copyright 2016-2024 gitopscentral · All Rights Reserved ·