Courseiva
File Sharing and SambaeasyMultiple SelectObjective-mapped

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

Source Router + ACL permit 10.0.0.0/8 deny any Server 10.0.0.5 ✓ 192.168.1.1 ✗ dropped ACLs evaluate top-down; first match wins — implicit deny all at end

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 →

How Courseiva writes practice questions · Editorial policy

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.