Sunday, May 5, 2024
 Popular · Latest · Hot · Upcoming
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

 Answers
4

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.


  • Run 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.


[#38393] Monday, July 26, 2021, 3 Years  [reply] [flag answer]
Only authorized users can answer the question. Please sign in first, or register a free account.
ameatoes

Total Points: 321
Total Questions: 106
Total Answers: 112

Location: Belarus
Member since Sat, Jul 18, 2020
4 Years ago
ameatoes questions
Tue, Aug 16, 22, 22:50, 2 Years ago
Fri, May 14, 21, 03:36, 3 Years ago
Sat, Oct 8, 22, 01:00, 2 Years ago
Fri, Feb 17, 23, 14:44, 1 Year ago
;