Lab activity

Resource Limits

Learn how to configure and manage Linux resource limits using ulimit, limits.conf, and PAM to control process, file, memory, and CPU usage.

Overview

Resource limits help Linux administrators control how much system resources users and processes can consume. In this lab, you will learn how to configure temporary and persistent resource limits to improve system stability, performance, and security. You will work with the ulimit command, /etc/security/limits.conf, and the /etc/security/limits.d/ directory to manage limits on open files, processes, CPU time, file sizes, memory usage, and other system resources.

In This Lab, You’ll Learn How To

  • View current resource limits using ulimit
  • Configure soft and hard resource limits
  • Manage limits for users and groups
  • Configure persistent limits using limits.conf
  • Create custom limits files in limits.d
  • Inspect process resource limits through /proc
  • Understand how PAM applies resource limits at login

Key Resource Management Components

  • ulimit for viewing and modifying shell limits
  • /etc/security/limits.conf for persistent limits
  • /etc/security/limits.d/ for custom limit configurations
  • Soft limits that users can modify within allowed ranges
  • Hard limits that define maximum allowed values
  • /proc/<PID>/limits for process-specific limits

Command Examples

Display all current resource limits:

ulimit -a

View the open file descriptor limit:

ulimit -n

Set a soft limit for open files:

ulimit -Sn 512

View persistent resource limits:

cat /etc/security/limits.conf

View limits for the current process:

cat /proc/$$/limits

Learning Outcomes

  • Understand Linux resource management concepts
  • Configure soft and hard resource limits
  • Manage user and group resource restrictions
  • Apply persistent limits using PAM configuration files
  • Develop practical Linux administration skills

Conclusion

Completing this lab will help you gain practical experience configuring and managing resource limits in Linux. You will learn how to control resource consumption, protect system stability, and enforce user-level restrictions using standard Linux administration tools. These skills are important for Linux system administration, LFCS preparation, and maintaining reliable multi-user Linux systems.