Courseiva
hardMultiple ChoiceObjective-mapped

XK0-006 Practice Question: Ensure that /var/log/secure is only readable by…

An administrator needs to ensure that /var/log/secure is only readable by members of the 'adm' group and is not accessible by any other user. Additionally, new files created in /var/log should inherit the group ownership 'adm'. Which set of commands achieves this?

⚠ Common exam trap

CompTIA often tests the distinction between setting group ownership on a file versus a directory, and the requirement to use the setgid bit for inheritance, which candidates frequently overlook by only changing permissions on the file itself.

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

chgrp adm /var/log; chmod g+s /var/log; setfacl -m g:adm:rx /var/log/secure

Ly sets the group ownership of /var/log to 'adm' with `chgrp adm /var/log`, enables the setgid bit on the directory with `chmod g+s /var/log` so new files inherit the 'adm' group, and uses `setfacl -m g:adm:rx /var/log/secure` to grant only the 'adm' group read and execute access to the secure log file, while removing permissions for others via the default ACL mask.

Answer analysis

Option-by-option breakdown

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

  • setfacl -m u::rwx,g::rwx,o::--- /var/log/secure; chmod g+s /var/log

    Why it's wrong here

    ACL incorrectly gives group rwx instead of rx, and order of operations is fine but the ACL is too permissive.

  • chgrp adm /var/log; chmod g+s /var/log; setfacl -m g:adm:rx /var/log/secure

    Why this is correct

    Sets group ownership, sgid on directory, and ACLs to make /var/log/secure readable by adm group only.

  • chown :adm /var/log/secure; chmod 640 /var/log/secure

    Why it's wrong here

    While chmod 640 sets owner read/write and group read, it does not set sgid on /var/log, so new files will not inherit group.

  • usermod -aG adm $(whoami); chmod 640 /var/log/secure

    Why it's wrong here

    This adds the user to adm group but does not set inheritance for new files.

Visual reference

Source Router + ACL permit 10.0.0.0/8 deny any Server 10.0.0.5 ✓ 192.168.1.1 ✗ dropped ACLs evaluate top-down; first match wins — implicit deny all at end

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.