LPIC-2 System Security Practice Question
Exhibit
Refer to the exhibit. ``` # /etc/sudoers Defaults:user !requiretty user ALL=(root) NOPASSWD: /usr/bin/apt-get update user ALL=(root) /usr/bin/apt-get upgrade ```
Refer to the exhibit. The user 'user' reports that they are able to run 'sudo apt-get update' without a password, but 'sudo apt-get upgrade' prompts for a password. What is the most likely cause?
⚠ Common exam trap
Candidates often assume all commands in a sudoers file inherit the NOPASSWD tag from a previous rule, but sudoers rules are independent and tags apply only to the specific command specification they accompany.
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
✓
The second rule does not include the NOPASSWD tag, so password is required.
The sudoers rule for 'apt-get upgrade' lacks the NOPASSWD tag, so sudo defaults to requiring a password. The first rule for 'apt-get update' includes NOPASSWD, which allows passwordless execution, but each command specification in sudoers is independent unless explicitly grouped. The absence of NOPASSWD on the second rule means sudo will prompt for the user's password as per its default behavior.
Answer analysis
Option-by-option breakdown
For each option: why learners choose it and why it is or isn't the right answer here.
- ✓
The second rule does not include the NOPASSWD tag, so password is required.
Why this is correct
Only the first rule has NOPASSWD; the second rule defaults to password authentication.
- ✗
The 'Defaults:user !requiretty' setting affects password prompting.
Why it's wrong here
The requiretty option affects TTY requirements, not password prompting.
- ✗
The command 'apt-get upgrade' is being run as the user, not as root.
Why it's wrong here
Sudo runs commands as root regardless of the NOPASSWD tag.
- ✗
The rules are in the wrong order, causing the second to be overridden.
Why it's wrong here
Order does not cause this issue; both rules apply sequentially.
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.