A daemon started from your bash session keeps hitting a 'too many open files' error. Which command raises the limit on open file descriptors for the current shell and the processes it starts to 4096?
LPIC-1 Exam 102-500, objective 110. Security medium
Draft — not checked yet. This question was written from the published exam objectives and cites the clause it comes from, but nobody has yet read it against that clause and signed for it.
It is kept out of search results and out of mock exams until they have. Read the source below before you take the answer as settled.
The options
Not correct ulimit -u 4096
Wrong. -u sets the maximum number of processes a single user may have running, not the number of file descriptors a process may hold open.
Not correct ulimit -c 4096
Wrong. -c sets the maximum size of a core dump file; in bash the value is in 1024-byte units. `ulimit -c 0` is the common form, used to switch core dumps off.
Not correct ulimit -f 4096
Wrong. -f caps the size of the largest file the shell and its children may write, again in 1024-byte units, and it is the option ulimit assumes when none is given.
Correct ulimit -n 4096
Correct. -n sets the maximum number of open file descriptors. Limits are inherited, so children of this shell get the new value.
Why
ulimit is a shell builtin that manipulates the per-process resource limits the kernel enforces. Each limit has a soft value (-S, the one actually enforced and freely lowerable) and a hard ceiling (-H, which an unprivileged user can only lower, never raise). `ulimit -a` prints them all. Because a ulimit set in a shell dies with that shell, permanent per-user limits belong in /etc/security/limits.conf or a file under /etc/security/limits.d, applied by pam_limits at login.
Where this comes from
- Cited
- LPI exam objective 110.1
- What it says
- Use ulimit to discover and set resource limits on user processes.
Practise this
Reading one question is not practice. The trainer will draw a set from objective 110 and space the ones you get wrong.