8
rated 0 times
[
8]
[
0]
/ answers: 1 / hits: 6838
/ 3 Years ago, mon, july 26, 2021, 1:19:22
I want to be able to automatically terminate ssh connections that are idle for more than 10 minutes.
How do I do this?
More From » ssh
I want to be able to automatically terminate ssh connections that are idle for more than 10 minutes.
How do I do this?
Open up terminal, Ctrl-Alt-T
. Then:
sudo gedit /etc/ssh/sshd_config
Set (or modify) the following options:
ClientAliveInterval 600
ClientAliveCountMax 0
Save and exit the editor.
sudo service ssh restart
ClientAliveInterval
sets the period after which, if the server sees the client as idle, it will send a "keep alive" request. If it gets no response, the client is disconnected. ClientAliveCountMax
is the number of times such a keep alive is requested before disconnection. By setting it to 0, the keepalive is never sent and all clients idle for more than 10 minutes (600 seconds) are disconnected.