I am facing an issue whereby the ssh session is not terminated upon exit. Which will result in hitting the MaxSession defined in the sshd_config file.

ps auxwww | grep sshd:
root      7877  0.0  0.0  86884  3488 ?        Ss   10:42   0:00 sshd: root@pts/0
root      7989  0.0  0.0  86860  3832 ?        Ss   10:43   0:00 sshd: root@pts/1
root      8080  0.0  0.0  86860  3828 ?        Ss   10:43   0:00 sshd: root@pts/2
root     12364  0.0  0.0 109148   804 pts/2    S+   11:06   0:00 grep sshd:

The current configured ClientAliveInterval is as 0, meaning to say the server will not check with the client on the keep-alive status.

Is there a way or reason as to why my ssh session is not terminated clean ?

  • 1
    what were you doing in your ssh sessions? Can you take one of the process IDs, e.g. 7877 and paste the output of pstree -p 7877 into the question? – icarus Dec 2 '16 at 5:50

Not terminating connection does not change anything in case of MaxSessions. This option is used only for connection multiplexing (ControlMaster feature).

It very depends on how you exit your sessions. If you do that properly, the server side should exist straight away (unless there is something terribly broken. What OS are you using? What openssh version?). How long are these connections left open here?

  • Hi Jakuje, yes i agree with you. I have tested in my lab environment, various method of exiting/terminating an ssh session. I am suspecting that the sshd service might have hung which is why i am receiving that error. – user2691544 Dec 15 '16 at 10:16

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.