Question 129 of 510
SecuritymediumMultiple SelectObjective-mapped

Quick Answer

The correct answer combines setting PasswordAuthentication no in sshd_config with two complementary access controls: an iptables rule restricting SSH traffic to the 192.168.1.0/24 subnet and an AllowUsers directive matching that IP range. This layered approach is essential because disabling password authentication alone doesn’t block brute-force attempts from outside the subnet, while network-level filtering via iptables ensures only traffic from the allowed range reaches the SSH daemon. On the CompTIA Linux+ XK0-005 exam, this question tests your understanding of defense in depth—combining host-based firewall rules with SSH configuration directives to enforce both network and application-level restrictions. A common trap is thinking iptables alone suffices, but the exam expects you to recognize that AllowUsers provides an additional layer even if the firewall is misconfigured. Remember the mnemonic “FAD”: Firewall (iptables), AllowUsers, and Disable passwords—three steps that lock down SSH from the network to the service itself.

XK0-005 Security Practice Question

This XK0-005 practice question tests your understanding of security. Match the stated requirement to the specific cloud service, access model, or configuration option — many options are valid in isolation but not for this scenario. 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.

An administrator needs to restrict SSH access to the server so that only a specific IP range (192.168.1.0/24) can connect, and password authentication is disabled. Which THREE steps must be taken?

Question 1mediummulti select
Full question →

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 a firewall rule: iptables -A INPUT -p tcp --dport 22 -s 192.168.1.0/24 -j ACCEPT; iptables -A INPUT -p tcp --dport 22 -j DROP

Option B is correct because it uses iptables to create a firewall rule that accepts SSH traffic (TCP port 22) only from the 192.168.1.0/24 subnet, followed by a catch-all rule that drops all other SSH traffic. This enforces network-level access control. Option D is correct because 'AllowUsers *@192.168.1.*' in sshd_config restricts SSH logins to users connecting from IP addresses matching that pattern, providing application-level filtering. Option E is correct because 'PasswordAuthentication no' disables password-based authentication, forcing the use of key-based or other non-password methods.

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.

  • Set 'UsePAM yes' in sshd_config

    Why it's wrong here

    This enables PAM, not IP restriction.

  • Add a firewall rule: iptables -A INPUT -p tcp --dport 22 -s 192.168.1.0/24 -j ACCEPT; iptables -A INPUT -p tcp --dport 22 -j DROP

    Why this is correct

    Firewall restricts source IP at network layer.

    Related concept

    Read the scenario before looking for a memorised answer.

  • Set 'PermitRootLogin without-password' in sshd_config

    Why it's wrong here

    This only affects root login, not source IP restriction.

  • Add 'AllowUsers *@192.168.1.*' to /etc/ssh/sshd_config

    Why this is correct

    This restricts SSH login to users originating from that subnet.

    Related concept

    Read the scenario before looking for a memorised answer.

  • Set 'PasswordAuthentication no' in sshd_config

    Why this is correct

    Disables password-based authentication.

    Related concept

    Read the scenario before looking for a memorised answer.

Common exam traps

Common exam trap: answer the scenario, not the keyword

The trap here is that candidates may think 'UsePAM yes' or 'PermitRootLogin without-password' are necessary for IP restriction or disabling passwords, when in fact they address unrelated authentication mechanisms and are not among the three required steps.

Detailed technical explanation

How to think about this question

The iptables rules in option B use a stateful firewall approach: the first rule accepts SSH from the allowed subnet, and the second rule drops all other SSH traffic, effectively creating a whitelist. The 'AllowUsers' directive in sshd_config uses pattern matching (globbing) to filter by client IP at the application layer, which can complement firewall rules. Disabling password authentication (PasswordAuthentication no) forces clients to use public key authentication, which is more secure and is a common requirement for compliance with standards like PCI-DSS.

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 small business has 20 workstations on the 192.168.1.0/24 network and one public IP from its ISP. The router uses PAT (NAT overload) so all 20 devices share one public address using different source ports. NAT questions test whether you understand the four address terms and which direction each translation applies.

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.

Related practice questions

Related XK0-005 practice-question pages

Use these pages to review the topic behind this question. This is how one missed question becomes focused revision.

Practice this exam

Start a free XK0-005 practice session

Short sessions build daily habit. Longer sessions build exam-day stamina. Try a timed session to simulate real conditions.

FAQ

Questions learners often ask

What does this XK0-005 question test?

Security — This question tests Security — Read the scenario before looking for a memorised answer..

What is the correct answer to this question?

The correct answer is: Add a firewall rule: iptables -A INPUT -p tcp --dport 22 -s 192.168.1.0/24 -j ACCEPT; iptables -A INPUT -p tcp --dport 22 -j DROP — Option B is correct because it uses iptables to create a firewall rule that accepts SSH traffic (TCP port 22) only from the 192.168.1.0/24 subnet, followed by a catch-all rule that drops all other SSH traffic. This enforces network-level access control. Option D is correct because 'AllowUsers *@192.168.1.*' in sshd_config restricts SSH logins to users connecting from IP addresses matching that pattern, providing application-level filtering. Option E is correct because 'PasswordAuthentication no' disables password-based authentication, forcing the use of key-based or other non-password methods.

What should I do if I get this XK0-005 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 →

How Courseiva writes practice questions · Editorial policy

Last reviewed: Jun 25, 2026

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.

Loading comments…

Sign in to join the discussion.

This XK0-005 practice question is part of Courseiva's free CompTIA 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 XK0-005 exam.