This LPIC-2 practice question tests your understanding of system security. This is a configuration task: choose the command set that satisfies every stated requirement. Small differences — like 'secret' vs 'password' or 'transport input ssh' vs 'all' — change whether the answer is correct. After answering, compare your reasoning against the explanation and wrong-answer breakdown below. Once you have made your selection, read the full explanation to reinforce the concept and understand why each distractor is designed to mislead on exam day.
Exhibit
Refer to the exhibit.
# cat /etc/ssh/sshd_config | grep -v '^#' | grep -v '^$'
Port 22
Protocol 2
PermitRootLogin no
PubkeyAuthentication yes
PasswordAuthentication no
ChallengeResponseAuthentication no
UsePAM yes
AllowUsers alice bob
DenyUsers charlie
Based on the sshd configuration, user 'charlie' attempts to log in using public key authentication. What will happen?
Refer to the exhibit.
# cat /etc/ssh/sshd_config | grep -v '^#' | grep -v '^$'
Port 22
Protocol 2
PermitRootLogin no
PubkeyAuthentication yes
PasswordAuthentication no
ChallengeResponseAuthentication no
UsePAM yes
AllowUsers alice bob
DenyUsers charlie
A
Login is denied because the DenyUsers directive explicitly blocks charlie.
DenyUsers blocks charlie regardless of authentication.
B
Login is allowed because PasswordAuthentication is disabled, but public key authentication is enabled.
Why wrong: DenyUsers applies to all authentication methods.
C
Login is allowed because AllowUsers includes other users but does not deny charlie.
Why wrong: DenyUsers explicitly denies charlie.
D
Login is denied because charlie's IP address is not in the allowed list.
Why wrong: No IP-based restrictions are configured.
Answer the question above first, then reveal the full breakdown to understand why each option is right or wrong.
Correct answer & explanation
✓
Login is denied because the DenyUsers directive explicitly blocks charlie.
The DenyUsers directive in sshd_config explicitly blocks the user 'charlie' from logging in, regardless of the authentication method. Since DenyUsers takes precedence over AllowUsers and other authentication settings, public key authentication will still be denied for charlie. The correct answer is A because the directive explicitly denies charlie, overriding any other configuration.
Key principle: Answer the scenario, not the keyword: identify the specific constraint before choosing the most familiar-sounding option.
Answer analysis
Option-by-option breakdown
For each option: why learners choose it and why it is or isn't the right answer here.
✓
Login is denied because the DenyUsers directive explicitly blocks charlie.
Why this is correct
DenyUsers blocks charlie regardless of authentication.
Related concept
Read the scenario before looking for a memorised answer.
✗
Login is allowed because PasswordAuthentication is disabled, but public key authentication is enabled.
Why it's wrong here
DenyUsers applies to all authentication methods.
✗
Login is allowed because AllowUsers includes other users but does not deny charlie.
Why it's wrong here
DenyUsers explicitly denies charlie.
✗
Login is denied because charlie's IP address is not in the allowed list.
Why it's wrong here
No IP-based restrictions are configured.
Common exam traps
Common exam trap: answer the scenario, not the keyword
The trap here is that candidates often assume that enabling public key authentication automatically allows login, ignoring the explicit DenyUsers directive that takes precedence over authentication methods.
Detailed technical explanation
How to think about this question
In OpenSSH, the sshd_config directives are processed in a specific order: DenyUsers, AllowUsers, DenyGroups, AllowGroups. DenyUsers is checked first, so if a user is listed there, they are denied immediately, regardless of other directives. This is a security feature to ensure that explicit denials cannot be bypassed by other settings. In real-world scenarios, this is used to block specific users even if they are part of an allowed group or have valid keys.
KKey Concepts to Remember
Read the scenario before looking for a memorised answer.
Find the constraint that changes the correct option.
Eliminate answers that are true in general but not in this case.
TExam Day Tips
→Watch for words such as best, first, most likely and least administrative effort.
→Review why wrong options are wrong, not only why the correct option is correct.
Key takeaway
Answer the scenario, not the keyword: identify the specific constraint before choosing the most familiar-sounding option.
Real-world example
How this comes up in practice
A security administrator must allow nursing staff to reach a patient records server while blocking access from the guest Wi-Fi VLAN. After applying an extended ACL, traffic is still blocked from nursing workstations. The ACL was applied outbound instead of inbound on the wrong interface. Questions like this test ACL direction and placement rules.
What to study next
Got this wrong? Here's your next step.
Identify which exam domain this question belongs to, review the core concept, then practise similar questions from the same domain.
System Security — This question tests System Security — Read the scenario before looking for a memorised answer..
What is the correct answer to this question?
The correct answer is: Login is denied because the DenyUsers directive explicitly blocks charlie. — The DenyUsers directive in sshd_config explicitly blocks the user 'charlie' from logging in, regardless of the authentication method. Since DenyUsers takes precedence over AllowUsers and other authentication settings, public key authentication will still be denied for charlie. The correct answer is A because the directive explicitly denies charlie, overriding any other configuration.
What should I do if I get this LPIC-2 question wrong?
Identify which exam domain this question belongs to, review the core concept, then practise similar questions from the same domain.
What is the key concept behind this question?
Read the scenario before looking for a memorised answer.
About these practice questions
Courseiva creates original exam-style practice questions with explanations and wrong-answer analysis. It does not publish real exam questions, exam dumps, or protected exam content. Learn why practice questions differ from exam dumps →
Share a tip, memory trick, or ask about the reasoning behind this question. Do not post real exam questions, leaked content, braindumps, or copyrighted exam material. Comments are moderated and may be removed without notice.
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.
Question Discussion
Share a tip, memory trick, or ask about the reasoning behind this question. Do not post real exam questions, leaked content, braindumps, or copyrighted exam material. Comments are moderated and may be removed without notice.
Sign in to join the discussion.