Limit concurrent SSH sessions

Jakub Jelen jjelen at redhat.com
Tue Aug 20 19:35:40 AEST 2019


On Tue, 2019-08-20 at 14:05 +0530, Amit Prajapati wrote:
> Hi,
> 
> For one of my application, for accepting the ssh connection on
> different
> namespaces, I am instantiating "sshd service" on different
> namespaces. I am
> able to  create ssh connection on each namespcae but I want to put a
> limitation on max concurrent ssh connection to 5 for each namespace.
> Is
> there a way to achieve it using openssh.

I don't think there is a way to do that in the OpenSSH itself, since
each of the ssh sessions on the server is separate process without any
information about the others.

But you can simply do that using pam, for example using pam_limits
module, and maxlogins option in limits.conf.

Regards,
-- 
Jakub Jelen
Senior Software Engineer
Security Technologies
Red Hat, Inc.



More information about the openssh-unix-dev mailing list