Environment
- RHEL/CentOS 5
- RHEL/CentOS 6
- RHEL/CentOS 7
- RHEL/CentOS 8
Issue
-
The default configuration file for ulimit is /etc/security/limits.d/90-nproc.conf for (RHEL5, RHEL6), /etc/security/limits.d/20-nproc.conf for (RHEL7) and for RHEL 8 we have to create file /etc/security/limits.d/20-nproc.conf specifies the default
nproclimits as,:* soft nproc 1024 root soft nproc unlimited -
Even when logged in as root, the
ulimitshows a different value:$ ulimit -u 1024 -
It is a bit confusing that it is not
unlimitedin this case? - Now we have a question in our mind that how to set or change the default
softorhard limitfor the number of user’s processes?
Resolution
If we have to set the nproc limit to unlimited for all system , Need to change in the file /etc/security/limits.d/90-nproc.conf (RHEL5, RHEL6), /etc/security/limits.d/20-nproc.conf (RHEL7, RHEL8) should read:
-
For the
rootuser:root hard nproc unlimited -
For the ‘root’ user, both ‘soft’ and ‘hard’:
root - nproc unlimited -
or, for default domain again both ‘soft’ and ‘hard’ for example:
* - nproc unlimited -
The
unlimitedoption applied to thesoftvalue for a domain cannot go beyond itshardlimit. -
Re-login for changes to take effect:
$ ulimit -u -
Another option to set the limits per session based is to specify it on the command line:
$ ulimit -u unlimited -
The above command applies to both
softandhardlimits.
Note:
1- The pam of RHEL5 and RHEL8 don’t provide any files under /etc/security/limits.d. If necessary, make the file.
2- RHEL8 does not have the file /etc/security/limits.d/20-nproc.conf, so if you want to limit nproc on RHEL8, you need to create a file like /etc/security/limits.d/20-nproc.conf in /etc/security/limits.d/.
Now you have successfully increased ulimit to unlimited. Please share this article if helpful

