LPIC-2 System Security Practice Question
A system administrator wants to allow the user 'jdoe' to run the '/usr/bin/systemctl restart httpd' command on a specific server without a password prompt. Which sudoers entry achieves this?
⚠ Common exam trap
The trap here is that candidates often forget the NOPASSWD tag and select option A, assuming that any sudo entry allows passwordless execution, or they confuse the username placeholder 'user' with the actual username in option C.
Answer choices
Why each option matters
Answer the question above first, then reveal the full breakdown to understand why each option is right or wrong.
Correct answer & explanation
✓
jdoe ALL=(ALL) NOPASSWD: /usr/bin/systemctl restart httpd
The NOPASSWD tag in the sudoers entry explicitly allows user 'jdoe' to execute the specified command '/usr/bin/systemctl restart httpd' without being prompted for a password. The syntax 'jdoe ALL=(ALL) NOPASSWD: /usr/bin/systemctl restart httpd' grants passwordless execution for that exact command on any host, which matches the requirement.
Answer analysis
Option-by-option breakdown
For each option: why learners choose it and why it is or isn't the right answer here.
- ✗
jdoe ALL=(ALL) /usr/bin/systemctl restart httpd
Why it's wrong here
Specifies command but still requires password.
- ✓
jdoe ALL=(ALL) NOPASSWD: /usr/bin/systemctl restart httpd
Why this is correct
Grants passwordless execution of the specific command.
- ✗
user ALL=(ALL) NOPASSWD: /usr/bin/systemctl restart httpd
Why it's wrong here
Wrong username; 'user' does not match 'jdoe'.
- ✗
jdoe ALL=(ALL) ALL
Why it's wrong here
No command restriction and requires password.
Go deeper
Related to this question
About these practice questions
One of 507 original LPIC-2 practice questions on Courseiva, each with a full explanation and wrong-answer analysis — not exam dumps or protected exam content. Learn why practice questions differ from exam dumps →
JA
Written by Johnson Ajibi, MSc IT Security
Senior Network & Security Engineer · founder of Courseiva
This LPIC-2 practice question is part of Courseiva's free LPI certification practice question bank. Courseiva provides original exam-style practice questions with explanations, topic-based practice, mock exams, readiness tracking, and study analytics to help learners prepare for the LPIC-2 exam.