LPIC-2 File Sharing and Samba Practice Question
Which TWO smb.conf parameters can be used to restrict access to a share based on client IP address or network?
⚠ Common exam trap
A common mix-up: candidates confuse `hosts allow` with the non-existent `allow hosts` parameter, or mistakenly think `valid users` or `invalid users` can filter by IP address, when they only filter by username.
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
✓
hosts deny
The `hosts allow` and `hosts deny` parameters in smb.conf control access to Samba shares based on the client's IP address or network. `hosts allow` explicitly permits connections from specified hosts or networks, while `hosts deny` explicitly blocks them. These parameters are evaluated in order, with `hosts deny` taking precedence if both are specified, making them the correct pair for IP-based access restriction.
Answer analysis
Option-by-option breakdown
For each option: why learners choose it and why it is or isn't the right answer here.
- ✓
hosts deny
Why this is correct
This parameter specifies IP addresses or networks that are denied access.
- ✗
valid users
Why it's wrong here
This parameter restricts access by username, not IP.
- ✗
allow hosts
Why it's wrong here
This is not a valid smb.conf parameter.
- ✗
invalid users
Why it's wrong here
This parameter restricts access by username, not IP.
- ✓
hosts allow
Why this is correct
This parameter specifies IP addresses or networks that are allowed access.
Visual reference
Go deeper
Related to this question
About these practice questions
Courseiva writes every LPIC-2 question from scratch — 507 in total, each with an explanation and a wrong-answer breakdown. None are copied from real exams or 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.