1. limits.conf Configuration File Description
limits.conf file is actually Linux PAM (plug-in authentication module, pluggable authentication Modules) pam_limits.so configuration file, break through the system's default limits, to the system access to resources have a certain protection role. The difference between limits.conf and sysctl.conf is that limits.conf is for the user, and sysctl.conf is for the entire system parameter configuration.
2. How limits.conf Works
Limits.conf is the pam_limits.so configuration file, and then the/etc/pam.d/application calls the Pam_***.so module. For example, when the user accesses the server, the service program sends the request to the PAM module, and the PAM module selects a corresponding service file under the/ETC/PAM.D directory according to the service name, and then selects the specific PAM module for processing according to the contents of the service file.
3. limit.conf file format
#/etc/security/limits.conf# #Each Line describes a limit forA userinchThe form:##<domain> <type> <item> <value># #Where: #<domain>can be:#-a user name#-a group name, with @group syntax#-The wildcard *, for defaultentry#-The wildcard%, can be also used with%Group syntax,# forMaxlogin limit##<type>can has the values:#-"Soft" forenforcing the soft limits#-" Hard" forEnforcing Hard limits##<item>can be one of the following:#-Core-limits the core file size (KB) #-Data-Max data Size (KB) #-Fsize-maximum FileSize (KB) #-Memlock-max locked-inch-Memory address Space (KB) #-Nofile-max number of open file descriptors#-Rss-max residentSetsize (KB) #-Stack-Max stack size (KB) #-CPU-Max CPU Time (MIN) #-Nproc-Max Number of processes#- as-address space Limit (KB) #-Maxlogins-max Number of logins for Thisuser#-Maxsyslogins-Max Number of logins on the system#-Priority-The priority to run user process with#-Locks-max number of file locks the user can hold#-Sigpending-max number of pending signals#-Msgqueue-max memory used by POSIX message queues (bytes) #-Nice-max nice priority allowed to raise to values: [- -, +]# -Rtprio-Max Realtime priority##<domain> <type> <item> <value>##* Soft Core0#* Hard RSS10000# @student Hard Nproc -# @faculty Soft Nproc -# @faculty Hard Nproc -#ftp Hard Nproc0# @student-Maxlogins4# End of File* Soft Core0* Hard Core0* Soft Nofile32768* Hard Nofile65536
username| @groupname Type Resource limit
Resource represents the resource to restrict
core-limits the size of the kernel file
What is a core file that, when a program crashes, copies the stored image of the process in the core file of the current working directory of the process. The core file is simply a memory image (plus debugging information), which is used primarily for debugging purposes. The core file is a binary file that requires a tool to parse the memory image when the program crashes, and the system default core file size is 0, so it is not created. You can use the Ulimit command to view and modify the size of the core file, for example:
#ulimit –c
0
#ulimit-C 1000
-c Specifies the size of the core file to be modified, and 1000 specifies the core file size. You can also make no restrictions on the size of the core file, such as: Ulimit-c Unlimited
Note: If you want the changes to take effect permanently, you need to modify the configuration file, such as. Bash_profile,/etc/profile, or/etc/security/limits.conf
Nofile-Maximum number of open files
For applications that need to make many socket connections and leave them open, it is best to set the number of file descriptors higher than the default values for the user by using Ulimit-n or by setting the Nofile parameter.
Maxlogins-Maximum number of logons allowed by this user
Note: For the limits.conf file configuration to take effect, you must make sure that the pam_limits.so file is added to the startup file. Viewing/etc/pam.d/login files are: Session required/lib/security/pam_limits.so
4. limits.conf Settings Use
example, if the Oracle database is deployed on the machine, we need to make the following adjustments to the Oracle user's resources, as follows:
# Oracle Limits resourceoracle soft nproc 2047Oracle hard nproc 16384oracle soft nofile Oracle Hard Nofile 65536oracle soft stack 10240
For the limits.conf file configuration to take effect, you must make sure that the pam_limits.so file is added to the startup file. The view/etc/pam.d/login file has:
Session required/lib/security/pam_limits.so
--View the global configuration of the current system configuration file Ulimit
Ulimit-a
If no specific settings are made, the default configuration is used, as seen below:
' ^* ' /etc/security/limits.conf
Annotations: When using the * number for the global user to take effect, the value of the Nproc is affected by the file/etc/security/limits.d/90- The size of the Nproc value in nproc.conf is restricted, and if it is only for a user, it is not affected by the size of the Nproc value of the file.
Linux system/etc/security/limits.conf Configuration