I sometimes find the following message in auth.log:
sshd: error: no more sessions
In sshd_config I have set "MaxStartups 300", and I shouldn't have nearly as many clients connecting concurrently. At busy times I guess that I could have about 50-60 concurrent connections which only lasts for a couple of seconds while up/downloading a small file over sftp.
I suspect that mayby some of the clients isnt't closing the connection as they should, and as the connections happen repeadiately and quite frequenty (each client connecting a few times per minute), it could be adding up over time. To troubleshoot this I want to be able to count the SSH sessions, but I cant think of any better way than to count the connections using netstat:
netstat -an | grep 123.456.789.abc:22 | wc -l
As this would be counting connections instead of sessions and I am unsure if there is a case where the session would live, but the connection is closed?
Is there any better way of counting the current connectins, or even better print the current state of all sessions?
Thanks in advance!