Courseiva
SecuritymediumMultiple ChoiceObjective-mapped

XK0-006 Security Practice Question

A firewall administrator wants to add a rule to allow incoming SSH traffic (port 22) using firewalld. Which command correctly adds this rule to the default zone 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 --add-service=ssh --permanent adds the SSH service permanently. Option A lacks --permanent, Option C is missing the required protocol specification (e.g., /tcp), and Option D lacks --permanent. While --add-port=22/tcp would also work, --add-service is more descriptive and easier to manage.

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-port=22/tcp

    Why it's wrong here

    This command adds port 22/tcp but without the --permanent flag, so it only affects the runtime configuration, not the permanent configuration.

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

    Why this is correct

    Correct. This command adds the ssh service permanently to the default zone using the --permanent flag.

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

    Why it's wrong here

    This command is incorrect because it lacks the protocol (/tcp) specification. The correct syntax requires the protocol (e.g., 22/tcp) when using --add-port.

  • firewall-cmd --zone=public --add-service=ssh

    Why it's wrong here

    This command adds the ssh service to the public zone, but it does not include the --permanent flag, so the rule is not permanent. Also, the question specifies the default zone, so specifying a zone is unnecessary.

About these practice questions

Courseiva writes every XK0-006 question from scratch — 979 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 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.