Increasing number of processes allowed to be run by a user on RHEL / CentOS 6 0

By default, many of the Linux distributions (including RHEL / CentOS 6) limit the number of processes that a user can spawn.  This is mainly done to prevent fork bombs from bringing down a system inadvertently.

On RHEL and CentOS 6, the default is 1024 processes per user.  In some cases, you do need to increase the number of processes that a particular user can spawn in order to support ‘busy’ applications (think database servers, etc.)

Some symptoms that may indicate that you need to increase this value are out of memory errors, processes failing to start, and failure to execute sub-functions of a program. You can check how many processes are in use for a specific user with the command ‘ps -L -u | wc -l’.

These modern distributions have moved to a model where ‘nproc’ (nproc = maximum number of processes) is set in /etc/security/limits.d/90-nproc.conf; example:


# Default limit for number of user's processes to prevent
# accidental fork bombs.
# See rhbz #432903 for reasoning.

* soft nproc 1024

To increase the per-user limit, simply edit this file. You can either increase the default, global value for all users, or specify the new limit value based on the format found in ‘man limits.conf’.

A reboot is not required for this to take effect, however, the user must be completely logged out (and have no processes running). The next time the user logs back in, the new value will be in place. This can be checked by running ‘ulimit -u’ as the user in question.

Note: I do not recommend setting the ‘nproc’ value to unlimited (a.k.a., -1). You still want your server to have some form of protection against an infinite loop, processes fork bomb, etc. These are not always intentional and a it is good practice to adjust this value accordingly to your specific use case.