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
nproc
limits as,:* soft nproc 1024 root soft nproc unlimited
-
Even when logged in as root, the
ulimit
shows a different value:$ ulimit -u 1024
-
It is a bit confusing that it is not
unlimited
in this case? - Now we have a question in our mind that how to set or change the default
soft
orhard limit
for 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
root
user: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
unlimited
option applied to thesoft
value for a domain cannot go beyond itshard
limit. -
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
soft
andhard
limits.
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