easyMultiple SelectObjective-mapped
XK0-006 Practice Question: A system administrator wants to restrict SSH…
A system administrator wants to restrict SSH access to a specific group of users. Which two methods can achieve this? (Select TWO.)
⚠ Common exam trap
A common mix-up: candidates confuse system-level access control files (like `/etc/security/access.conf`) or PAM modules with SSH-specific directives, or mistakenly think adding users to the `sshd` group grants SSH access, when in fact `AllowGroups` and `AllowUsers` are the correct, direct methods for restricting SSH access to specific users or groups.
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
✓
Edit /etc/ssh/sshd_config and set AllowGroups engineers
The `AllowGroups` directive in `/etc/ssh/sshd_config` explicitly restricts SSH access to members of specified groups. When set to `AllowGroups engineers`, only users belonging to the 'engineers' group can authenticate via SSH, providing a straightforward and secure method for group-based access control.
Answer analysis
Option-by-option breakdown
For each option: why learners choose it and why it is or isn't the right answer here.
- ✗
Use /etc/security/access.conf
Why it's wrong here
This file works with PAM for general access control but is not SSH-specific.
- ✓
Edit /etc/ssh/sshd_config and set AllowGroups engineers
Why this is correct
The AllowGroups directive restricts SSH access to members of specified groups.
- ✗
Modify /etc/pam.d/sshd to use pam_listfile.so
Why it's wrong here
Modifying `/etc/pam.d/sshd` with `pam_listfile.so` restricts access based on a static file list, but the question requires restricting SSH access to a specific *group* of users. This PAM module checks individual usernames against a file, not group membership; it cannot evaluate whether a user belongs to a group like `AllowGroups` does in `sshd_config`. It is tempting because `pam_listfile.so` is a flexible PAM tool for allowing or denying users via a custom list, which would be correct if the requirement were to restrict by a static user list rather than by group membership.
- ✗
Add users to the sshd group
Why it's wrong here
There is no default sshd group for access control; this is not a standard method.
- ✓
Edit /etc/ssh/sshd_config and set AllowUsers user1,user2,user3
Why this is correct
AllowUsers explicitly lists which users are allowed to connect via SSH.
Go deeper
Related to this question
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 →
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.