CompTIA XK0-006 (CompTIA Linux+) Practice Test 31

Question 300

An image needs a default command that operators can replace when invoking docker run. Which Dockerfile instruction suits it?

  1. docker tag app:v1 app:stable
  2. FROM ubuntu:24.04
  3. CMD ["python", "app.py"]
  4. docker image prune

Explanation

Correct Answer

C:

CMD supplies a default command or arguments for container startup and can be overridden at run time. ENTRYPOINT has different override semantics.

Incorrect Answers

A:

docker tag creates another local image reference pointing at the same image; that changes a different part of the system; the requested outcome is supplying an overridable container default command.

B:

FROM selects a base stage or image for Dockerfile instructions; this does not achieve supplying an overridable container default command on the system described.

D:

docker image prune removes dangling images by default, subject to prompts and filters; using it would leave supplying an overridable container default command unresolved.

Question 301

An engineer must see all local images and their tags before deleting obsolete versions. Which command is suitable?

  1. docker image prune
  2. docker build -t app:v1 .
  3. ENTRYPOINT ["/usr/local/bin/wrapper"]
  4. docker images

Explanation

Correct Answer

D:

docker images lists locally known image references and sizes. It does not enumerate stopped containers or running processes.

Incorrect Answers

A:

docker image prune removes dangling images by default, subject to prompts and filters; it does not deliver enumerating locally stored container images, which is decisive in this scenario.

B:

docker build executes build instructions from the chosen context and records a tag for the resulting image; the evidence calls for enumerating locally stored container images, not merely this separate operation.

C:

ENTRYPOINT sets the main executable while command arguments can be supplied separately; the task involves enumerating locally stored container images, whereas this addresses another subsystem.

Question 302

A syslog service must receive and route traditional facility/severity messages to log files or a remote collector. Which daemon is common?

  1. rsyslog
  2. logrotate
  3. journalctl --since '1 hour ago'
  4. auditd

Explanation

Correct Answer

A:

rsyslog processes syslog messages, applies routing rules and can forward them across the network. It complements rather than replaces all journal features.

Incorrect Answers

B:

logrotate applies per-log policies for rotation, retention and optional compression; it answers a neighboring question rather than routing structured syslog events.

C:

journalctl queries stored systemd journal entries and supports time, unit and priority filters; that changes a different part of the system; the requested outcome is routing structured syslog events.

D:

auditd receives Linux audit-subsystem events according to configured rules; this does not achieve routing structured syslog events on the system described.

Question 303

A login service wants directory identities but must avoid storing service account passwords in scripts. Which mechanism is more appropriate?

  1. Accurate host and KDC time synchronization
  2. The matching authentication stack fails
  3. Kerberos keytab for a service principal
  4. getent group domain_group

Explanation

Correct Answer

C:

A keytab stores cryptographic keys enabling noninteractive Kerberos authentication for an authorized principal. Protecting the file is critical because it grants authentication capability.

Incorrect Answers

A:

Kerberos ticket validity windows limit tolerated clock skew to prevent replay; using it would leave authenticating a service without embedding a password unresolved.

B:

pam_deny returns failure and a required failure usually causes the transaction to be rejected; the requirement is authenticating a service without embedding a password, outside the effect of this choice.

D:

getent uses NSS lookup rules so the result can include directory-backed groups; the evidence calls for authenticating a service without embedding a password, not merely this separate operation.

Question 304

Systemd services need their logs retrieved from the binary journal with time filters. Which utility is used?

  1. logrotate
  2. auditd
  3. rsyslog
  4. audit.rules file watch rule
  5. journalctl --since '1 hour ago'

Explanation

Correct Answer

E:

journalctl queries stored systemd journal entries and supports time, unit and priority filters. Persistence depends on journal configuration.

Incorrect Answers

A:

logrotate applies per-log policies for rotation, retention and optional compression; its scope differs from querying recent entries in the systemd journal, so it cannot meet the stated requirement.

B:

auditd receives Linux audit-subsystem events according to configured rules; that is not equivalent to querying recent entries in the systemd journal.

C:

rsyslog processes syslog messages, applies routing rules and can forward them across the network; the administrator instead needs querying recent entries in the systemd journal; this option serves a different purpose.

D:

Audit rules specify watched paths and syscall conditions, then the audit subsystem records matching activity; it answers a neighboring question rather than querying recent entries in the systemd journal.

Question 305

Linux nodes need identity caching and centralized authentication integration while offline logins remain possible for cached users. Which component commonly supports this?

  1. SSSD
  2. Polkit
  3. Kerberos authentication
  4. Checking the user's rights before allowing an operation

Explanation

Correct Answer

A:

The System Security Services Daemon integrates supported identity providers and can cache identity and credentials according to policy. It does not replace a directory server.

Incorrect Answers

B:

Polkit mediates policy-based authorization for privileged actions requested by unprivileged processes; it will not provide caching centralized identity data on Linux clients under these conditions.

C:

Kerberos uses tickets from a trusted key distribution center to authenticate principals to services; using it would leave caching centralized identity data on Linux clients unresolved.

D:

Authorization evaluates whether an already identified subject is permitted to perform an action; the requirement is caching centralized identity data on Linux clients, outside the effect of this choice.

Question 306

A Linux audit implementation must define rules for sensitive-file activity and collect the resulting kernel audit records. Which TWO components serve those roles? Choose TWO.

  1. rsyslog
  2. aureport
  3. audit.rules file watch rule
  4. ausearch
  5. auditd

Explanation

Correct Answers

C:

Persistent audit rules specify which paths or syscalls the kernel should record, whereas auditd receives and stores resulting audit events. Defining a watch is not enough without a functioning audit record collection path.

E:

auditd receives Linux audit-subsystem events according to configured rules. It can record selected filesystem and process activity for review.

Incorrect Answers

A:

rsyslog processes syslog messages, applies routing rules and can forward them across the network; the evidence calls for defining filesystem audit conditions and recording kernel audit events, not merely this separate operation.

B:

aureport aggregates stored audit events into categories and counts; the task involves defining filesystem audit conditions and recording kernel audit events, whereas this addresses another subsystem.

D:

ausearch queries audit records using identifiers and filters; that is not equivalent to defining filesystem audit conditions and recording kernel audit events.

Question 307

Login policy must be applied through interchangeable authentication modules across local services. Which Linux framework supports this?

  1. PAM stack configuration
  2. Checking the user's rights before allowing an operation
  3. SSSD
  4. LDAP directory queries

Explanation

Correct Answer

A:

Pluggable Authentication Modules let applications invoke configured authentication, account, session and password modules. Module order and control flags affect acceptance.

Incorrect Answers

B:

Authorization evaluates whether an already identified subject is permitted to perform an action; that changes a different part of the system; the requested outcome is composing authentication policy from PAM modules.

C:

The System Security Services Daemon integrates supported identity providers and can cache identity and credentials according to policy; this does not achieve composing authentication policy from PAM modules on the system described.

D:

LDAP provides directory lookups for identities, groups and attributes; it will not provide composing authentication policy from PAM modules under these conditions.

Question 308

A Kerberos client keeps failing because its clock differs substantially from the KDC. Which prerequisite should be corrected?

  1. Authorization policy
  2. Samba smbd service
  3. Accurate host and KDC time synchronization
  4. The matching authentication stack fails

Explanation

Correct Answer

C:

Kerberos ticket validity windows limit tolerated clock skew to prevent replay. Correct NTP discipline often resolves clock-skew login errors.

Incorrect Answers

A:

Authentication success proves identity, not access to each resource; the requirement is correcting a Kerberos clock-skew prerequisite, outside the effect of this choice.

B:

Samba implements SMB file sharing to Windows and Linux clients; it does not deliver correcting a Kerberos clock-skew prerequisite, which is decisive in this scenario.

D:

pam_deny returns failure and a required failure usually causes the transaction to be rejected; the task involves correcting a Kerberos clock-skew prerequisite, whereas this addresses another subsystem.

Question 309

A Samba server needs to publish Windows-compatible SMB file shares and integrate access checks. Which server software is appropriate?

  1. Kerberos keytab for a service principal
  2. Authorization policy
  3. Samba smbd service
  4. The matching authentication stack fails

Explanation

Correct Answer

C:

Samba implements SMB file sharing to Windows and Linux clients. Its authentication and filesystem-permission integration both affect access.

Incorrect Answers

A:

A keytab stores cryptographic keys enabling noninteractive Kerberos authentication for an authorized principal; that is not equivalent to serving SMB shares from a Linux system.

B:

Authentication success proves identity, not access to each resource; the administrator instead needs serving SMB shares from a Linux system; this option serves a different purpose.

D:

pam_deny returns failure and a required failure usually causes the transaction to be rejected; that changes a different part of the system; the requested outcome is serving SMB shares from a Linux system.

Question 310

A desktop application wants authorization to perform a privileged action without running the entire desktop as root. Which framework is suitable?

  1. Winbind
  2. Checking the user's rights before allowing an operation
  3. PAM stack configuration
  4. Polkit
  5. Kerberos authentication

Explanation

Correct Answer

D:

Polkit mediates policy-based authorization for privileged actions requested by unprivileged processes. Its rules are separate from ordinary filesystem permission bits.

Incorrect Answers

A:

Samba's Winbind provides domain user and group resolution and authentication integration; it will not provide authorizing a privileged desktop or service action under these conditions.

B:

Authorization evaluates whether an already identified subject is permitted to perform an action; using it would leave authorizing a privileged desktop or service action unresolved.

C:

Pluggable Authentication Modules let applications invoke configured authentication, account, session and password modules; the requirement is authorizing a privileged desktop or service action, outside the effect of this choice.

E:

Kerberos uses tickets from a trusted key distribution center to authenticate principals to services; the evidence calls for authorizing a privileged desktop or service action, not merely this separate operation.

CompTIA Linux+ (XK0-006) Practice Tests