How to check the current number of SSH sessions

This article provides information on how to check the number of current SSH sessions.

At times, when using SSH to logon to a Junos device, the connection fails; even when the IP address is reachable. This may be due to the SSH session limitation being exceeded.

A default SSH session limitation, which has a default value of 75, is present in Junos OS release 12.2. This can be modified via the configuration under the [system – service – ssh – connection-limit] hierarchy.

If the number of the current SSH sessions (including the active and stale sessions) is equal to the maximum limitation, a new SSH session will not be established.

Even though it is possible to display the number of active sessions being carried by the chassis, (via the show system users command), stale sessions might still exist and they cannot be displayed in the output of the command. You can use the following shell command to check how many SSH sessions are currently being carried by the chassis:

Each sshd line represents one SSH session. By checking the result, you can tell how many SSH sessions are being carried by this chassis. To release some of these SSH sessions, use the kill command to terminate them by using the corresponding PID:

By releasing some of the existing (possibly stale) SSH sessions, new SSH sessions can be successfully established.

About the author

Prasanna

Leave a Comment