Question

I need a limit (let's say to 6) how many users can be logged in my Linux (CentOS 6.3) system. Users use ssh to connect my server. Server is meant to do simulations and that's why I have need to restrict maximum number of users whom can use the server at a time, because the resources are limited.

I tried to change sshd_config MaxSessions and MaxStartups but no cigar.

If the sshd does not provide this kind of limitation, is there possibility to restrict maximum number of logged-in users via PAM or SELinux

Was it helpful?

Solution

You can try setting a restriction in /etc/security/limits.conf. According to man limits.conf from my system, you should be able to write

* hard maxsyslogins 6
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top