Annoying SSH session expiring

Probably you do remember so many situations like you have this connection to your VPS and accidentally you have to go to pick up package from delivery man or just want some coffee. You are get back and what?

Read from remote host VPS: Connection reset by peer

If you had not any screen or something like that – session has lost with your current work.

Fortunately, there is possibility to change this setup and enjoy longer not expiring SSH session during connection with your VPS.

We are starting with editing setup file:

Next add or uncomment lines:

At the end do not forget about restarting sshd service:

So, server stops sending TCP packets into the connected clients checking if they are still alive. It will send encrypted messages for every 30 seconds, 100 times before decide to disconnect.

But remember, it so close to security stuff! If you use SSH connections in public space, with computers not owned by you and you are forgetful person it is not so good idea to extend session timeout since you expose yourself on huge risk of unprivileged usage your VPS.