Zend certified PHP/Magento developer

Limit maximum ssh connections per user does not work when shell is /sbin/nologin

I’m having a Centos 7 server and when I limit the maximum connections per user using the config file /etc/security/limits.conf it works just fine. See below an example of my configuration in that file:

user1  -   maxlogins   1
user2  -   maxlogins   1

However, if the shell associated to the user is /sbin/nologin, it does not work anymore. I created some users that are used only for port forwarding. Since I want to restrict rights for these users as much as I can, I assigned them to shell /sbin/nologin.

So, is there a work around about this issue? What I want is to limit maximum connections for these users too.

Thank you in advance.

G. Plante