0

I have 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:

@users -   maxlogins   1

However, if the shell associated with 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.

also, I change these lines in /etc/ssh/sshd_config

MaxSessions 1
MaxStartups 1

but nothing happens.

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

Thank you in advance.

New contributor
Dr developer is a new contributor to this site. Take care in asking for clarification, commenting, and answering. Check out our Code of Conduct.
4
  • 1
    Have you try to add in limits.conf line with maxsyslogins set to 1? 1 hour ago
  • 1
    Also do you have in sshd_config PAM line like: session required pam_limits.so? 1 hour ago
  • maxsyslogins not works and there is no option in sshd_config to control session per user. 49 mins ago
  • sshd_config PAM record 43 mins ago

0

You must log in to answer this question.

Browse other questions tagged .