limit – ExpLinux https://www.explinux.com Explore Linux How to, Tutorials, Unix, Updates, Technology. Fri, 21 May 2021 10:49:20 +0000 en-US hourly 1 https://wordpress.org/?v=6.7.1 https://www.explinux.com/wp-content/uploads/2023/04/cropped-favicon-32x32-1-32x32.png limit – ExpLinux https://www.explinux.com 32 32 How to set ulimit or change the default soft or hard limit for the number of user’s processes? https://www.explinux.com/2020/12/how-to-set-ulimit-or-change-default.html https://www.explinux.com/2020/12/how-to-set-ulimit-or-change-default.html#respond Fri, 11 Dec 2020 10:56:00 +0000 How to set ulimit or change the default soft or hard limit for the number of user’s processes? Read More »

]]>
 

How to set ulimit unlimited

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 (RHEL5RHEL6), /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 or hard 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 (RHEL5RHEL6), /etc/security/limits.d/20-nproc.conf (RHEL7RHEL8) 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 the soft value for a domain cannot go beyond its hard 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 and hard 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 

]]>
https://www.explinux.com/2020/12/how-to-set-ulimit-or-change-default.html/feed 0