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

Machine-checked — no person has signed for it. This question was read against the source cited below by an automated pass, which found no contradiction. That is a weaker claim than it sounds: the same kind of process wrote the question, so it can confirm its own mistake.

Treat it as a good draft rather than as settled fact, and read the source below before you rely on it. It is not used in mock exams here — only questions a person has signed for are.

How these questions are written — where each question comes from, what the verification ledger records, and what happens when one is found wrong.

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 short set from objective 110 and space the ones you get wrong.

Practise LPIC-1 Exam 102-500

More questions on this objective

All questions on Security

Practise LPIC-1 Exam 102-500