TECH SOLUTIONS

Click here to edit subtitle

Forums

Post Reply
Forum Home > Unix Learnings > Apply limit on total number of ssh connections

Sourav Gulati
Site Owner
Posts: 83

If you want to apply a limit on total number of ssh connections , it can be applied in "/etc/security/limits.conf" file.

Following is the example:

#<domain>      <type>  <item>         <value>

user1                -       maxlogins        2

According to the above entry in the "limits.conf" file , user "user1" can have maximum of two ssh connections.

If you want to apply a limit on total number of ssh connections on the system. it can be done as follows:

*                      -       maxsyslogins     4

According to above entry in "limits.conf " file , maximum 4 ssh connections can be made on the system, does not matter which user has made the connection.


Following are the other options which you can use according to the requirement:

#        - core - limits the core file size (KB)

#        - data - max data size (KB)

#        - fsize - maximum filesize (KB)

#        - memlock - max locked-in-memory address space (KB)

#        - nofile - max number of open files

#        - rss - max resident set size (KB)

#        - stack - max stack size (KB)

#        - cpu - max CPU time (MIN)

#        - nproc - max number of processes

#        - as - address space limit (KB)

#        - maxlogins - max number of logins for this user

#        - maxsyslogins - max number of logins on the system

#        - priority - the priority to run user process with

#        - locks - max number of file locks the user can hold

#        - sigpending - max number of pending signals

#        - msgqueue - max memory used by POSIX message queues (bytes)

#        - nice - max nice priority allowed to raise to values: [-20, 19]

#        - rtprio - max realtime priority

#        - chroot - change root to directory (Debian-specific)

 

 




--


December 12, 2012 at 3:58 AM Flag Quote & Reply

You must login to post.