While auditing a production server you discover the following entry in /etc/sudoers:
%devteam ALL=(ALL) NOPASSWD: /usr/bin/vim
Developers in the devteam group occasionally need to update /etc/nginx/nginx.conf, but the security team wants to minimize the risk of privilege escalation that could occur through shell-escape features or editor vulnerabilities. Which change will best satisfy the functional requirement and apply the principle of least privilege?
Move /usr/bin/vim to a root-writable directory such as /usr/local/bin and leave the rule unchanged.
Replace the line with: %devteam ALL=(ALL) sudoedit /etc/nginx/nginx.conf and remove the NOPASSWD tag.
Keep the existing rule but add the NOEXEC tag so vim cannot execute external commands.
Add Defaults:%devteam timestamp_timeout=0 so members must enter their password for every sudo invocation.
Replacing the rule with sudoedit runs the editor with the caller's normal privileges; only the file-copy operation is performed with elevated rights, so any shell escapes execute as the user, not as root. Removing NOPASSWD restores password prompts and logging, further tightening security.
Adding the NOEXEC tag (choice B) blocks many but not all shell escapes and still leaves the editor running with full root privileges. A zero timestamp timeout (choice C) merely forces more frequent password entry; it does not remove the ability to spawn a root shell. Moving the binary (choice D) does nothing to prevent vim from launching a root shell once invoked with sudo. Therefore, the sudoedit approach is the most effective hardening measure in this scenario.
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.
Why is sudoedit preferred over vim for this task?
Open an interactive chat with Bash
What does the NOPASSWD tag do, and why was it removed?
Open an interactive chat with Bash
What is the principle of least privilege, and how does this solution implement it?
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...
Pass with Confidence.
IT & Cybersecurity Package
You have hit the limits of our free tier, become a Premium Member today for unlimited access.
Military, Healthcare worker, Gov. employee or Teacher? See if you qualify for a Community Discount.
Monthly
$19.99
$19.99/mo
Billed monthly, Cancel any time.
3 Month Pass
$44.99
$14.99/mo
One time purchase of $44.99, Does not auto-renew.
MOST POPULAR
Annual Pass
$119.99
$9.99/mo
One time purchase of $119.99, Does not auto-renew.
BEST DEAL
Lifetime Pass
$189.99
One time purchase, Good for life.
What You Get
All IT & Cybersecurity Package plans include the following perks and exams .