Intermediate LevelLinux Commands & SysAdmin
How do ulimit -n and /etc/security/limits.conf increase maximum open file descriptors?
❓ Interview Prompt: Explain ulimit command, Soft limits vs Hard limits, /etc/security/limits.conf, and increasing open file descriptor limits for high-traffic servers.
By default, Linux limits the number of open file descriptors per shell session to 1024 ('ulimit -n'), causing high-concurrency web servers to fail with 'Too many open files' errors!
Soft vs Hard Limits:
•
Soft Limit: Active limit enforced by kernel; users can raise it up to the Hard limit.
•
Hard Limit: Maximum cap configured by root in '/etc/security/limits.conf'.
Code Implementation Example
ini
# /etc/security/limits.conf - Increasing file descriptor limits for deploy user
deploy soft nofile 65536
deploy hard nofile 65536
root soft nofile 65536
root hard nofile 65536💡Increasing maximum open file descriptor limits in /etc/security/limits.conf.
🎯 Interview Key Takeaway
Increase file descriptor limits in /etc/security/limits.conf to prevent 'Too many open files' errors on high-concurrency servers.
#ulimit#File Descriptors#sysadmin#Intermediate
Back to all Linux Commands & SysAdmin Questions→