XK0-005 Online Practice Questions

Home / CompTIA / XK0-005

Latest XK0-005 Exam Practice Questions

The practice questions for XK0-005 exam was last updated on 2025-09-02 .

Viewing page 1 out of 34 pages.

Viewing questions 1 out of 174 questions.

Question#1

An administrator runs ping comptia.org.
The result of the command is:
ping: comptia.org: Name or service not known
Which of the following files should the administrator verify?

A. /etc/ethers
B. /etc/services
C. /etc/resolv.conf
D. /etc/sysctl.conf

Explanation:
The best file to verify when the ping command returns the error “Name or service not known” is C. /etc/resolv.conf. This file contains the configuration for the DNS resolver, which is responsible for translating domain names into IP addresses. If this file is missing, corrupted, or has incorrect entries, the ping command will not be able to resolve the domain name and will fail with the error. To fix this issue, the administrator should check that the file exists, has proper permissions, and has valid nameserver entries. For example, a typical /etc/resolv.conf file may look like this: nameserver 8.8.8.8 nameserver 8.8.4.4
These are the IP addresses of Google’s public DNS servers, which can be used as a fallback option if the default DNS servers are not working.

Question#2

A Linux administrator needs to rebuild a container with the httpd service in order to change some default parameters.
Which of the following should be the first command line in the Dockerfile?

A. FROM httpd
B. BASE httpd
C. USE httpd
D. INHERIT httpd

Explanation:
In Docker, a Dockerfile is a script that contains instructions to build a container image. The first line in a Dockerfile is typically the FROM directive, which specifies the base image from which the container will be built.
The correct syntax for specifying a base image is:rubyFROM <image>:<tag>If no tag is provided, Docker will pull the latest version of the specified image by default.
The correct syntax for specifying a base image is:rubyFROM <image>:<tag>If no tag is provided, Docker will pull the latest version of the specified image by default.
The correct syntax for specifying a base image is:rubyFROM <image>:<tag>If no tag is provided, Docker will pull the latest version of the specified image by default.
The correct syntax for specifying a base image is:rubyFROM <image>:<tag>If no tag is provided, Docker will pull the latest version of the specified image by default.
The correct syntax for specifying a base image is:rubyFROM <image>:<tag>If no tag is provided, Docker will pull the latest version of the specified image by default. httpd is the official Apache HTTP Server image available in Docker Hub.
The incorrect options:
BASE httpd → Incorrect, as there is no such directive in Dockerfile syntax.
USE httpd → Incorrect, this is not a valid Docker command.
INHERIT httpd → Incorrect, as Docker does not use INHERIT to specify base images.
Thus, the correct answer is A. FROM httpd.
CompTIA Linux+ Official Documentation
Dockerfile Reference - Docker Docs
Official httpd Docker Image

Question#3

A systems administrator has been tasked with disabling the nginx service from the environment to prevent it from being automatically and manually started.
Which of the following commands will accomplish this task?

A. systemct1 cancel nginx
B. systemct1 disable nginx
C. systemct1 mask nginx
D. systemct1 stop nginx

Explanation:
The command systemct1 mask nginx disables the nginx service from the environment and prevents it from being automatically and manually started. This command creates a symbolic link from the service unit file to /dev/null, which makes the service impossible to start. This is the correct way to accomplish the task. The other options are incorrect because they either do not exist (systemct1 cancel nginx), do not prevent manual start (systemct1 disable nginx), or do not prevent automatic start (systemct1 stop nginx). CompTIA Linux+ (XK0-005) Certification Study Guide, Chapter 14: Managing Processes and Scheduling Tasks, page 429.

Question#4

The security team has identified a web service that is running with elevated privileges A Linux administrator is working to change the systemd service file to meet security compliance standards.
Given the following output:



Which of the following remediation steps will prevent the web service from running as a privileged user?

A. Removing the ExecStarWusr/sbin/webserver -D SOPTIONS from the service file
B. Updating the Environment File line in the [Service] section to/home/webservice/config
C. Adding the User-webservice to the [Service] section of the service file
D. Changing the:nulti-user.target in the [Install] section to basic.target

Explanation:
The remediation step that will prevent the web service from running as a privileged user is adding the User=webservice to the [Service] section of the service file. The service file is a configuration file that defines the properties and behavior of a systemd service. The systemd is a system and service manager that controls the startup and operation of Linux systems. The service file contains various sections and options that specify how the service should be started, stopped, and managed. The [Service] section defines how the service should be executed and what commands should be run. The User option specifies the user name or ID that the service should run as. The webservice is the name of the user that the administrator wants to run the web service as. The administrator should add the User=webservice to the [Service] section of the service file, which will prevent the web service from running as a privileged user, such as root, and improve the security of the system. This is the correct remediation step to use to prevent the web service from running as a privileged user. The other options are incorrect because they either do not change the user that the service runs as (removing the ExecStart=/usr/sbin/webserver -D OPTIONS from the service file or updating the EnvironmentFile line in the [Service] section to /home/webservice/config) or do not affect the user that the service runs as (changing the multi-user.target in the [Install] section to basic.target). CompTIA Linux+ (XK0-005) Certification Study Guide, Chapter 15: Managing System Services, page 458.

Question#5

Following the migration from a disaster recovery site, a systems administrator wants a server to
require a user to change credentials at initial login.
Which of the following commands should be used to ensure the aging attribute?

A. chage -d 2 user
B. chage -d 0 user
C. chage -E 0 user
D. chage -d 1 user

Explanation:
The chage command can be used to change the user password expiry information. The -d or --lastday option sets the last password change date. If the value is 0, the user will be forced to change the password at the next login. See chage command in Linux with examples and 10 chage command examples in Linux.

Exam Code: XK0-005Q & A: 496 Q&AsUpdated:  2025-09-02

 Get All XK0-005 Q&As