11

I sometimes find the following message in auth.log:

sshd[8888]: 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!

2
  • 1
    Does who shed any light on the situation?
    – Chris S
    Commented Sep 20, 2010 at 14:19
  • Not certain why, but connections over sftp doesnt seem to show up with who (not even who -a). Have to admit though, I had forgotten about who :) Cheers! Commented Sep 20, 2010 at 14:47

2 Answers 2

9

MaxStartups governs the number of "concurrent unauthenticated connections" to sshd, not sessions as such. (If limit is violated, it starts dropping older connections)

If you haven't already provided an explicit value for MaxSessions, it will default to 10. (Perhaps that's what you actually meant you'd set?)

You can see the man page for sshd_config more details: http://www.openbsd.org/cgi-bin/man.cgi?query=sshd_config&sektion=5

I don't see that sshd itself has a facility for reporting stats of the type you're asking about (though I also didn't research it much, either.)

Regards, Sapp3r.

3
  • I currently have no MaxSessions in the config, so this may very well be the case. I'll check it out and get back to you. In the meanwhile +1. Cheers! Commented Sep 21, 2010 at 15:16
  • Apperently there is not MaxSessions flag for OpenSSH 4.7, it won't start the service if I have this in the config. OpenSSH 5.3, however, supports this option. Unfortunately this is a production server, and I would not be comfortable to upgrade the SSH package. Commented Sep 23, 2010 at 9:57
  • While the answer doesn't really answer the question it might solve the problem, so ill accept this answer. I am in the middle of upgrading our setup, so i am not sure whether this will prevent the error in auth.log, but I hope that it will. Cheers' Commented Sep 28, 2010 at 9:55
7

[I realize this is a very old question but I'm adding this for posterity.]

The "no more sessions" message applies to multiplexed connections, not separate connections.

It appears to be #define'd at compile-time with MAX_SESSIONS for versions prior to 5.1, when the MaxSessions setting was introduced: http://www.openssh.com/txt/release-5.1

On RHEL5, at least, MAX_SESSIONS appears to have been increased to 20.

1
  • would tmux create multiplexed connections?
    – MikeyE
    Commented Feb 5, 2019 at 2:35

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .