Code Snippet

Just another Code Snippet site

Linux | /etc/security/limits.conf

Limiting user processes is important for running a stable system. To limit user process resource, you have just to set shell limit by adding:

  • a user name
  • or group name
  • or all users

to /etc/security/limits.conf file and impose then process limitations.

Example of /etc/security/limits.conf file

*               hard    nofile          65535
*               soft    nofile          4096
@student        hard    nproc           16384
@student        soft    nproc           2047

A soft limit is like a warning and hard limit is a real max limit. For example, following will prevent anyone in the student group from having more than 50 processes, and a warning will be given at 30 processes.

@student        hard    nproc           50
@student        soft    nproc           30

Hard limits are maintained by the kernel while the soft limits are enforced by the shell.

, , ,


2 thoughts on “Linux | /etc/security/limits.conf

Leave a Reply to OLIVIER COMBE Cancel reply

Your email address will not be published. Required fields are marked *