/Etc/security/limits. conf explanation and Application

Source: Internet
Author: User

The limits. conf format is as follows:
Username | @ groupname type resource limit

Username | @ groupname: Set the user name to be restricted. The group name is preceded by @ and the user name. You can also use wildcard * to restrict all users.

Type: soft, hard, and-. Soft indicates the setting value that takes effect for the current system. Hard indicates the maximum value that can be set in the system. Soft cannot be more restrictive than har. -Indicates that both soft and hard values are set.

Resource:
Core-restrict the size of kernel files
Date-maximum data size
Fsize-Maximum File Size
Memlock-maximum memory address space locked
Nofile-Maximum number of opened files
RSS-maximum persistent setting size
Stack-maximum stack size
CPU-maximum CPU time in minutes
Noproc-Maximum number of processes
As-address space limit
Maxlogins-Maximum number of logins allowed by this user

To make the limits. conf file take effect, make sure that the pam_limits.so file is added to the Startup File. View the/etc/PAM. d/login file:
Session required/lib/security/pam_limits.so

Temporarily, it is applicable when logging on to a shell session through the ulimit command.
Permanently, add a corresponding ulimit statement to one of the files read by the logon shell (for example ~ /. Profile), which is a shell-specific user resource file, or by editing/etc/security/limits. conf.
What is a core file? When a program crashes, the stored images of the process are copied to the core file in the current working directory of the process. The core file is only a memory image (with debugging information added) and is mainly used for debugging. The core file is a binary file, and a corresponding tool is required to analyze the memory image when the program crashes.

The default core file size is 0, so no file is created. You can use the ulimit command to view and modify the size of the core file.
$ Ulimit-C
0
$ Ulimit-C 1000
$ Ulimit-C
1000
-C specifies the size of the core file, and 1000 specifies the size of the core file. You can also limit the size of the core file, for example:
# Ulimit-C Unlimited
# Ulimit-C
Unlimited
If you want the change to take effect permanently, You need to modify the configuration file, such as. bash_profile,/etc/profile, or/etc/security/limits. conf.
2. nofile-Maximum number of opened files

For applications that require many socket connections and make them open, it is best to use ulimit-N or set the nofile parameter, set the number of file descriptors to a higher value than the default value.

 

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.