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.
-
- [Root @ Kumu ~] #Ulimit-// View the global coefficient of the current configuration file ulimit
-
- Core File size (blocks,-C) 0
-
- Data seg size (Kbytes,-d) Unlimited
-
- Scheduling Priority (-e) 0
- File size (blocks,-f) Unlimited
-
- Pending signals (-I) 1829
-
- Max locked memory (Kbytes,-l) 64
-
- Max memory size (Kbytes,-m) Unlimited
-
- Open File (-N) 1024
-
- Pipe size (512 bytes,-p) 8
- POSIX message queues (bytes,-q) 819200
-
- Real-time priority (-R) 0
-
- Stack size (Kbytes,-S) 10240
-
- CPU time (seconds,-T) Unlimited
-
- Max user processes (-u) 1024
-
- Virtual Memory (Kbytes,-v) Unlimited
- File locks (-x) Unlimited
-
- [Root @ Kumu ~] #Vim/etc/security/limits. conf
-
- [Root @ Kumu ~] #Grep '^ *'/etc/security/limits. conf
-
- * Soft nproc 10240
-
- * Hard nproc 10240
-
- * Soft nofile 10240
- * Hard nofile 10240
-
- [Root @ Kumu ~] #
Log out of the current user and log on again to make the modified limits take effect.
- [Root @ Kumu ~] #Ulimit-n
- 10240
- [Root @ Kumu ~] #Ulimit-u// It is found that nproc has not changed like nofile
- 1024
- [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)
- [Root @ Kumu ~] # Cat/etc/security/limits. d/90-nproc.conf
- # Default limit for number of user's processes to prevent
- # Accidental fork bombs.
- # See rhbz #432903 for reasoning.
-
- * Soft nproc 1024
- [Root @ Kumu ~] #
Modify the file to see if it is affected.
- [Root @ Kumu ~] # Vim/etc/security/limits. d/90-nproc.conf
- [Root @ Kumu ~] # Cat/etc/security/limits. d/90-nproc.conf
- # Default limit for number of user's processes to prevent
- # Accidental fork bombs.
- # See rhbz #432903 for reasoning.
-
- # * Soft nproc 1024
- * Soft nproc 65535
- [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.
- [Root @ Kumu ~] # Ulimit-u
- 10240
- [Root @ Kumu ~] # Ulimit-n
- 10240
- [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.
-
- [Root @ Kumu ~] # Vim/etc/security/limits. d/90-nproc.conf // restore system default settings
-
- [Root @ Kumu ~] # Cat/etc/security/limits. d/90-nproc.conf
- # Default limit for number of user's processes to prevent
-
- # Accidental fork bombs.
-
- # See rhbz #432903 for reasoning.
-
-
-
- * Soft nproc 1024
-
- # * Soft nproc 65535
-
- [Root @ Kumu ~] # Vim/etc/security/limits. conf // test only for a user (root is used here)
-
- [Root @ Kumu ~] # Grep '^ root'/etc/security/limits. conf
- Root soft nproc 10240
-
- Root hard nproc 10240
-
- [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.
- [Root @ Kumu ~] # Ulimit-u
- 10240
- [Root @ Kumu ~] # Ulimit-n
- 10240
- [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.