Courseiva
SecuritymediumMultiple ChoiceObjective-mapped

XK0-006 Security Practice Question

A Linux administrator needs to configure a firewall to allow incoming SSH connections on the default port. Which firewalld command accomplishes this permanently?

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

firewall-cmd --add-service=ssh --permanent && firewall-cmd --reload

The correct command adds the ssh service to the default zone permanently and reloads the firewall.

Answer analysis

Option-by-option breakdown

For each option: why learners choose it and why it is or isn't the right answer here.

  • firewall-cmd --add-service=ssh --permanent && firewall-cmd --reload

    Why this is correct

    Correctly adds the service permanently and reloads.

  • firewall-cmd --add-port=22/tcp --permanent

    Why it's wrong here

    Adding a port directly with `--add-port=22/tcp` bypasses the `ssh` service definition, which in firewalld includes not only port 22 but also associated protocol modules and logging rules. The question requires allowing incoming SSH connections, which is correctly achieved by `--add-service=ssh`, as the service abstraction ensures the firewall matches the full SSH protocol stack. This option is tempting because `--add-port` works for any custom port number, and would be correct if the administrator needed to open a non‑standard port not covered by a predefined service.

  • firewall-cmd --add-service=ssh

    Why it's wrong here

    Missing --permanent and --reload.

  • firewall-cmd --zone=public --add-port=22/tcp

    Why it's wrong here

    Missing --permanent and --reload.

About these practice questions

One of 979 original XK0-006 practice questions on Courseiva, each with a full explanation and wrong-answer analysis — not exam dumps or protected exam content. 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 XK0-006 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-006 exam.