Take the 2-minute tour ×
Server Fault is a question and answer site for professional system and network administrators. It's 100% free, no registration required.

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!

share|improve this question
    
Does who shed any light on the situation? –  Chris S Sep 20 '10 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! –  Avada Kedavra Sep 20 '10 at 14:47

2 Answers 2

up vote 2 down vote accepted

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.

share|improve this answer
    
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! –  Avada Kedavra Sep 21 '10 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. –  Avada Kedavra Sep 23 '10 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' –  Avada Kedavra Sep 28 '10 at 9:55

[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.

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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