LPIC-2 System Security Practice Question
An administrator wants to restrict SSH access to a server so that only users from the domain 'example.com' can connect. Which file and syntax should be used with TCP Wrappers?
⚠ Common exam trap
A common mix-up: candidates confuse the syntax of TCP Wrappers with that of iptables or fail to recognize that the leading dot in '.example.com' is the correct way to match an entire domain, leading them to choose options with incorrect keywords like 'ALLOW' or overly broad patterns like 'ALL'.
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
✓
Add to /etc/hosts.allow: sshd: .example.com
TCP Wrappers uses the /etc/hosts.allow file to grant access based on daemon: client patterns. The syntax 'sshd: .example.com' restricts SSH access to clients whose hostnames end with '.example.com', which matches all hosts in the 'example.com' domain. This is the standard way to allow only users from a specific domain to connect via SSH using TCP Wrappers.
Answer analysis
Option-by-option breakdown
For each option: why learners choose it and why it is or isn't the right answer here.
- ✗
Add to /etc/hosts.deny: sshd: ALL
Why it's wrong here
Would deny all, not allow only example.com.
- ✗
Add to /etc/hosts.allow: ALL: .example.com
Why it's wrong here
Would allow all services from example.com, not just SSH.
- ✓
Add to /etc/hosts.allow: sshd: .example.com
Why this is correct
Allows SSH connections from example.com domain.
- ✗
Add to /etc/hosts.allow: sshd: ALLOW .example.com
Why it's wrong here
Invalid syntax; the keyword ALLOW is not used.
Go deeper
Related to this question
About these practice questions
This LPIC-2 question is part of Courseiva's 507-question bank — original exam-style content with full explanations and wrong-answer analysis, never real exam questions or exam dumps. 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.