Limited-Time Offer: Enjoy 50% Savings! Coupon code: 50OFF Use it at checkout
Skip to content

Free CompTIA Linux+ V8 Exam XK0-006 Exam Questions

Last updated: · 12 practice questions with answers and explanations

Page: 1 / 15 Total 149 questions

Want more questions? Get Premium Access.

Question 1

New Single answer

Topic: System Management

Skill tested: Diagnoses Linux boot failures by distinguishing bootloader, kernel, and filesystem stages.

A Linux server was moved to a different storage controller. Firmware now detects the boot disk, and GRUB loads, but the system drops into an emergency shell because the root filesystem cannot be found. The root filesystem resides on an LVM logical volume whose device path is unchanged. The initramfs was generated before the move and contains only the previous controller's storage driver. The system must continue booting from the same LVM volume, and administrators can access a rescue environment. What is the BEST corrective action?

Correct Answer: A. Regenerate the initramfs with the required storage-controller driver, then rebuild the boot configuration if required by the distribution.
Explanation:

The bootloader has already loaded, but the kernel cannot access the storage controller early enough to discover the LVM-backed root volume. Regenerating the initramfs with the correct driver makes that driver available during early userspace; distribution-specific boot configuration may also need updating. Reinstalling GRUB does not add a missing kernel driver. Changing fstab cannot help when the root device is undiscoverable, and filesystem repair is not indicated by the symptoms.

Question 2

New Multiple answers

Topic: System Management

Skill tested: Configures persistent network addressing and DNS through a system's network management service.

A cloud operations team must give a Linux host a stable address on a managed subnet and ensure that its DNS resolver remains available after reboots and interface reconnections. The host uses NetworkManager, and administrators must not add a competing network configuration service. The subnet gateway and DNS server are known, and the interface currently obtains all settings through DHCP. Which TWO actions best meet the requirement? Select TWO.

Correct Answer: A. Configure the connection profile's IPv4 method for manual addressing and activate that profile on the managed interface.; D. Create or modify a NetworkManager connection profile with the required static address, gateway, and DNS settings.
Explanation:

NetworkManager connection profiles provide persistent interface configuration. A profile containing the static address, gateway, and DNS settings, with IPv4 configured for manual addressing, remains applicable when the connection is reactivated or the host reboots. Runtime ip commands do not persist. The hosts file resolves specific names locally but does not configure a DNS resolver. Running a competing network service violates the stated constraint and risks conflicting interface management.

Question 3

New Single answer

Topic: System Management

Skill tested: Uses LVM snapshots to create a point-in-time recovery source before a risky update.

Before a database package upgrade, an administrator wants a quick rollback option for the database volume if the upgrade fails. The volume is on LVM, the volume group has sufficient unallocated extents for a modest copy-on-write snapshot, and the database can be quiesced briefly. The snapshot is intended only as a temporary recovery point, not as a long-term backup or protection against loss of the storage array. What is the MOST appropriate approach?

Correct Answer: D. Create an LVM snapshot of the database logical volume while the database is quiesced, then monitor snapshot usage during the upgrade.
Explanation:

An LVM snapshot records the logical volume's point-in-time state and is suitable for a short-lived rollback source when the application is quiesced for consistency. Copy-on-write space must be monitored because a snapshot that fills can become unusable. A second PV in the same volume group is not an independent backup, RAID mirrors changes rather than providing a simple pre-upgrade rollback point, and copying a block device as a regular file while a database is active does not ensure a consistent image.

Question 4

New Single answer

Topic: Services and User Management

Skill tested: Sets default permissions for newly created files using umask and parent-directory permissions.

A development group shares files in /srv/projects. New files should be readable and writable by the owner and the project group, but not accessible to other users. New directories must also allow the group to create and modify files. The team uses a shared directory whose group ownership is already correct, and each user's shell startup sets a umask. Which umask best supports these requirements for ordinary file and directory creation, assuming applications request the usual 0666 and 0777 modes?

Correct Answer: A. 0002, with the shared directory's setgid bit enabled.
Explanation:

A umask of 0002 removes write permission for others while preserving group write: typical files become 0664 and directories 0775. The setgid bit on the shared project directory causes new entries to inherit its group, supporting collaboration. A umask of 0022 removes group write, while 0077 removes group access. A zero umask permits overly broad access, and the sticky bit controls deletion behavior in shared directories rather than group inheritance.

Question 5

New Multiple answers

Topic: Services and User Management

Skill tested: Uses systemd unit dependencies and journal logs to diagnose a service startup failure.

A custom web service is enabled at boot but repeatedly fails because it starts before its local data filesystem is mounted. The filesystem is defined in /etc/fstab and mounts successfully when started manually; the service unit currently has no ordering or dependency on that mount. Administrators want systemd to enforce the dependency and need evidence to verify the next boot. Which TWO actions are most appropriate? Select TWO.

Correct Answer: C. Add a RequiresMountsFor= directive for the service's data path in the unit, then reload systemd's unit configuration.; D. Review the service's boot-time messages with journalctl -u service-name and verify the mount dependency after reboot.
Explanation:

RequiresMountsFor= makes systemd pull in and order the mount units needed for the specified path, addressing the actual dependency rather than adding a timing delay. After editing a unit, systemd must reload unit definitions. journalctl -u provides the service's recorded startup output and helps confirm behavior after reboot. Network ordering does not guarantee a local mount, a sleep is nondeterministic, and disabling the mount contradicts the service's data requirement.

Question 6

New Single answer

Topic: Services and User Management

Skill tested: Configures recurring maintenance with a systemd timer and its associated service unit.

A team needs a maintenance script to run daily at 02:15, with execution recorded by systemd and no requirement for a continuously running daemon. The script should run as a dedicated service unit, and administrators want the schedule represented declaratively so it can be reviewed and managed with standard systemd tools. Which solution is MOST appropriate?

Correct Answer: C. Create a systemd service unit for the script and a corresponding timer unit with an OnCalendar= schedule, then enable the timer.
Explanation:

A systemd timer provides a declarative calendar trigger and activates its associated service, whose execution and output systemd can manage. Enabling the timer makes the schedule persistent across boots. A shell profile runs in user-session contexts and is not a reliable system scheduler; a target dependency has no daily trigger. A sleeping loop can drift, needs custom restart and failure handling, and is less suitable than the built-in timer mechanism.

Question 7

New Single answer

Topic: Security

Skill tested: Applies least-privilege sudo rules for a narrowly scoped administrative task.

A support team must allow one operator to restart a specific application service and inspect its status, without granting general root access or permitting arbitrary commands as root. The service name is fixed, and the organization requires command-based privilege delegation rather than sharing the root password. Which configuration best meets the requirement?

Correct Answer: D. Create a sudoers rule granting the operator permission to run only the exact systemctl restart and status commands for that service.
Explanation:

A narrowly scoped sudoers rule can delegate only the required systemctl operations on the named service, preserving least privilege and auditability. The rule should use exact command paths and arguments and be validated with visudo. Unrestricted wheel-group access grants far more authority than required. Setuid on a service executable is not a safe service-management control, and access to the shadow file neither enables controlled delegation nor protects account credentials.

Question 8

New Multiple answers

Topic: Security

Skill tested: Restricts inbound host traffic with a default-deny firewall policy and explicit service allowances.

A newly deployed Linux server provides HTTPS and SSH administration. The security baseline requires inbound traffic to be denied unless explicitly allowed; SSH must be reachable only from the operations subnet, while HTTPS must be reachable from client networks. The host uses nftables, and outbound traffic is not part of this change. Which TWO firewall decisions satisfy the requirement? Select TWO.

Correct Answer: A. Add an SSH accept rule limited to the operations subnet and an HTTPS accept rule for the intended client sources.; E. Set the input chain policy to drop and add explicit accept rules for established traffic and required inbound services.
Explanation:

A default-drop input policy implements the required deny-by-default posture, while explicit rules permit only established traffic and required services. Source-restricting SSH to the operations subnet and allowing HTTPS from intended clients matches the access requirements. Application authentication does not replace network filtering. Changing only the output policy does not control inbound exposure, and unrestricted SSH combined with restricted HTTPS reverses the stated access policy.

Question 9

New Single answer

Topic: Automation, Orchestration, and Scripting

Skill tested: Uses Ansible idempotently to enforce package and service state across Linux hosts.

An operations group manages a fleet of Linux application hosts with Ansible. A deployment must ensure that a package is installed and its service is enabled and running on every host. The playbook may be run repeatedly, and it must avoid reporting changes when the hosts already meet the desired state. Which implementation is BEST?

Correct Answer: A. Use package and service modules with explicit present, enabled, and started states in a play targeting the application hosts.
Explanation:

Ansible's package and service modules express desired state and are designed to be idempotent: repeated runs generally report no change when the package is installed and the service is already enabled and running. A shell task that always installs and restarts can report unnecessary changes and disrupt service availability. A marker file does not enforce either requirement, and manual per-host execution defeats centralized, repeatable configuration management.

Question 10

New Single answer

Topic: Automation, Orchestration, and Scripting

Skill tested: Writes robust shell conditionals that preserve command failures and handle filenames safely.

A backup script processes every regular file in a directory and records files that fail validation. Some filenames contain spaces, and the script must not treat a failed validation command as success. The directory may contain no matching files. Which shell approach is MOST reliable in Bash?

Correct Answer: B. Enable nullglob, iterate over a quoted directory glob, and use an if statement that tests the validator's exit status for each file.
Explanation:

With nullglob enabled, an unmatched Bash glob expands to no words rather than remaining as a literal pattern. Quoted iteration preserves filenames containing spaces, and testing the validator's exit status correctly distinguishes success from failure regardless of its output. Unquoted variables undergo word splitting and pathname expansion. Parsing ls output is fragile for unusual filenames, while output presence is not a dependable substitute for the command's status.

Question 11

New Single answer

Topic: Troubleshooting

Skill tested: Diagnoses DNS failures by separating name resolution from IP-layer connectivity.

Users report that an internal service is unavailable by its hostname. From an affected Linux client, pinging the service's known IP address succeeds, but applications cannot resolve the hostname. The client can reach its configured DNS server, and other hosts resolve the name correctly. There has been no recent firewall or routing change. What should the administrator do FIRST to isolate the likely fault?

Correct Answer: A. Inspect the client's resolver configuration and query the configured DNS server directly for the failing name.
Explanation:

Successful communication with the service IP demonstrates that basic IP connectivity is functioning, while the hostname-specific failure points toward name resolution. Checking resolver configuration and querying the configured DNS server directly distinguishes a client configuration problem from a record or server response issue. Changing the route is not supported by the evidence, a remote service process does not control DNS lookup, and disabling the firewall without evidence is an unsafe and poorly targeted action.

Question 12

New Multiple answers

Topic: Troubleshooting

Skill tested: Uses process and I/O metrics to identify storage latency behind application slowdowns.

A Linux application becomes sluggish during scheduled report generation. CPU utilization remains low, memory is available, and the load average rises sharply. Administrators suspect storage latency but have not yet identified which device or process is responsible. They need the NEXT diagnostic actions that provide evidence without changing system configuration. Which TWO are most appropriate? Select TWO.

Correct Answer: C. Use iostat with extended device statistics to inspect device utilization and I/O wait-related indicators during the slowdown.; D. Use a process-level I/O monitor such as pidstat -d to identify processes issuing heavy reads or writes.
Explanation:

Device-level statistics from iostat help determine whether a storage device is saturated or experiencing elevated service time, while pidstat -d helps associate I/O activity with processes. Collecting both during the observed slowdown can establish whether storage is the bottleneck and identify likely contributors without altering the system. Changing mount options or process priority before diagnosis risks masking the cause, and deleting files may disrupt services while doing nothing to address active I/O latency.