In some situations, you need an environment where limits are set to the system resources a user can use. For these environments, the pam_limits module was developed. This module reads its configuration from the configuration file /etc/security/limits.conf to determine which limitations should be applied. In this file, you can set limits for individual users as well as groups. You can apply the limits to different items, including the following:
• fsize: Maximum file size
• nofile: Maximum number of open files
• cpu: Maximum CPU time in minutes
• nproc: Maximum number of processes
• maxlogins: Maximum amount of times this user can login
Listing 5-6 shows two examples of how you can apply these limitations.
Listing 5-6. Applying Limitations to Resources ftp hard nproc 0
@student - maxlogins 4
When applying these limitations, you should be aware of the difference between hard and soft limits. A hard limit is absolute; a user cannot move above it. A soft limit can be passed, within the settings the administrator has applied for these soft limits. If you want to set the hard limit to the same as the soft limit, use -, as shown in Listing 5-6 for the group @student.
Was this article helpful?