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.
Go deeper
Related to this question
Learn chapter
Linux Fundamentals and History
Key term
SSH
SSH (Secure Shell) is a cryptographic network protocol that provides secure, encrypted communication and remote administration between two devices over an unsecured network.
Key term
firewalld
firewalld is a dynamic firewall management tool for Linux systems that controls incoming and outgoing network traffic using zones and rules.
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 →
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.