About the nproc restrictions of ulimit in rhel6

Source: Internet
Author: User
ArticleDirectory
    • Change the number of processes that a user can open in the Current Shell
    • Modify the limits. conf configuration file to take effect.
Change the number of processes that a user can open in the Current Shell

Modify the limits. conf configuration file to take effect.
  1. [Root @ Kumu ~] #Ulimit-// View the global coefficient of the current configuration file ulimit
  2. Core File size (blocks,-C) 0
  3. Data seg size (Kbytes,-d) Unlimited
  4. Scheduling Priority (-e) 0
  5. File size (blocks,-f) Unlimited
  6. Pending signals (-I) 1829
  7. Max locked memory (Kbytes,-l) 64
  8. Max memory size (Kbytes,-m) Unlimited
  9. Open File (-N) 1024
  10. Pipe size (512 bytes,-p) 8
  11. POSIX message queues (bytes,-q) 819200
  12. Real-time priority (-R) 0
  13. Stack size (Kbytes,-S) 10240
  14. CPU time (seconds,-T) Unlimited
  15. Max user processes (-u) 1024
  16. Virtual Memory (Kbytes,-v) Unlimited
  17. File locks (-x) Unlimited
  18. [Root @ Kumu ~] #Vim/etc/security/limits. conf 
  19. [Root @ Kumu ~] #Grep '^ *'/etc/security/limits. conf
  20. * Soft nproc 10240
  21. * Hard nproc 10240
  22. * Soft nofile 10240
  23. * Hard nofile 10240
  24. [Root @ Kumu ~] #

 

Log out of the current user and log on again to make the modified limits take effect.

    1. [Root @ Kumu ~] #Ulimit-n
    2. 10240
    3. [Root @ Kumu ~] #Ulimit-u// It is found that nproc has not changed like nofile
    4. 1024
    5. [Root @ Kumu ~] #

 

According to Google search, the configuration file is introduced in rhel6./Etc/security/limits. d/90-nproc.conf

(See @ Yang Devin's article redhat5 and redhat6 for different ulimits root users)

    1. [Root @ Kumu ~] # Cat/etc/security/limits. d/90-nproc.conf
    2. # Default limit for number of user's processes to prevent
    3. # Accidental fork bombs.
    4. # See rhbz #432903 for reasoning.
    5.  
    6. * Soft nproc 1024
    7. [Root @ Kumu ~] #

 

Modify the file to see if it is affected.

    1. [Root @ Kumu ~] # Vim/etc/security/limits. d/90-nproc.conf
    2. [Root @ Kumu ~] # Cat/etc/security/limits. d/90-nproc.conf
    3. # Default limit for number of user's processes to prevent
    4. # Accidental fork bombs.
    5. # See rhbz #432903 for reasoning.
    6.  
    7. # * Soft nproc 1024
    8. * Soft nproc 65535
    9. [Root @ Kumu ~] #

Log out of the current user and log on again to make the modified limits take effect. Run the following command to check that the modification is successful.

    1. [Root @ Kumu ~] # Ulimit-u
    2. 10240
    3. [Root @ Kumu ~] # Ulimit-n
    4. 10240
    5. [Root @ Kumu ~] #

 

Therefore, if you want to modify the nproc limit in the configuration file limits. conf/Etc/security/limits. d/90-nproc.confNproc value size inBut the shell terminal is not restricted.

In addition, I guess that if the * number is used to make global users take effectNproc value in/etc/security/limits. d/90-nproc.confBut if it is only for a user, it is not affected by the nproc value of the file.

  1. [Root @ Kumu ~] # Vim/etc/security/limits. d/90-nproc.conf // restore system default settings
  2. [Root @ Kumu ~] # Cat/etc/security/limits. d/90-nproc.conf
  3. # Default limit for number of user's processes to prevent
  4. # Accidental fork bombs.
  5. # See rhbz #432903 for reasoning.
  6.  
  7. * Soft nproc 1024
  8. # * Soft nproc 65535
  9. [Root @ Kumu ~] # Vim/etc/security/limits. conf // test only for a user (root is used here)
  10. [Root @ Kumu ~] # Grep '^ root'/etc/security/limits. conf
  11. Root soft nproc 10240
  12. Root hard nproc 10240
  13. [Root @ Kumu ~] #

 

Log out of the current user and log on again to make the modified limits take effect. Run the following command to check that the modification is successful.

    1. [Root @ Kumu ~] # Ulimit-u
    2. 10240
    3. [Root @ Kumu ~] # Ulimit-n
    4. 10240
    5. [Root @ Kumu ~] #

I previously guessed it is correct, that is, only when the * number is used for global users to take effect, the value of the nproc that takes effect is the file size./Etc/security/limits. d/90-nproc.confMediumNprocValue sizeBut if it is only for a user, it is not affected by the nproc value of the file.

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.