While hardening a server you need to let a developer view log files as root without opening a privileged shell. You add the following line to /etc/sudoers with visudo:
alice ALL=(root) NOEXEC: /usr/bin/less
Afterward Alice can run sudo less /var/log/secure, but when she presses ! inside less and tries !sh she receives the message "command execution disabled by sudo noexec". Which statement best describes how the NOEXEC tag enforces this restriction?
It intercepts exec-family system calls (using LD_PRELOAD or a seccomp filter), allowing the permitted program to run but blocking any attempt it makes to execute another binary.
It sets the environment variable SHELL=/bin/false, causing shell escapes to fail while leaving other program behavior unchanged.
It changes the program's effective UID to nobody, preventing it from launching set-UID binaries such as a shell.
It temporarily remounts all system filesystems with the noexec mount option so no new executable can be started.
The NOEXEC tag does not stop the listed binary itself from running; instead it blocks any attempt that binary makes to start another executable. Sudo accomplishes this by intercepting exec-family system calls. On most platforms it injects a small shared object with LD_PRELOAD; on modern Linux systems it may apply a seccomp filter. Either method lets the permitted program (here, less) run normally but causes every subsequent exec* call-such as the one used when less tries to spawn /bin/sh-to fail with the "command execution disabled by sudo noexec" error. NOEXEC does not remount filesystems, change effective UIDs, or rely on environment variables such as SHELL, so the other options are incorrect.
Ask Bash
Bash is our AI bot, trained to help you pass your exam. AI Generated Content may display inaccurate information, always double-check anything important.
What are exec-family system calls?
Open an interactive chat with Bash
How does LD_PRELOAD work to enforce the NOEXEC restriction?
Open an interactive chat with Bash
What is a seccomp filter, and how is it used in this context?
Open an interactive chat with Bash
CompTIA Linux+ XK0-006 (V8)
Security
Your Score:
Report Issue
Bash, the Crucial Exams Chat Bot
AI Bot
Loading...
Loading...
Loading...
IT & Cybersecurity Package Join Premium for Full Access