ExamGecko
Home Home / CompTIA / XK0-005

CompTIA XK0-005 Practice Test - Questions Answers

Question list
Search
Search

List of questions

Search

Related questions











A Linux administrator is scheduling a system job that runs a script to check available disk space every hour. The Linux administrator does not want users to be able to start the job. Given the following:

The Linux administrator attempts to start the timer service but receives the following error message:

Which of the following is MOST likely the reason the timer will not start?

A.
The checkdiskspace.timer unit should be enabled via systemctl.
A.
The checkdiskspace.timer unit should be enabled via systemctl.
Answers
B.
The timers.target should be reloaded to get the new configuration.
B.
The timers.target should be reloaded to get the new configuration.
Answers
C.
The checkdiskspace.timer should be configured to allow manual starts.
C.
The checkdiskspace.timer should be configured to allow manual starts.
Answers
D.
The checkdiskspace.timer should be started using the sudo command.
D.
The checkdiskspace.timer should be started using the sudo command.
Answers
Suggested answer: C

Explanation:

The most likely reason the timer will not start is that the checkdiskspace.timer should be configured to allow manual starts. By default, systemd timers do not allow manual activation via systemctl start, unless they have RefuseManualStart=no in their [Unit] section. This option prevents users from accidentally starting timers that are meant to be controlled by other mechanisms, such as calendar events or dependencies. To enable manual starts for checkdiskspace.timer, the administrator should add RefuseManualStart=no to its [Unit] section and reload systemd.

The other options are not correct reasons for the timer not starting. The checkdiskspace.timer unit does not need to be enabled via systemctl enable, because enabling a timer only makes it start automatically at boot time or after a system reload, but does not affect manual activation. The timers.target does not need to be reloaded to get the new configuration, because reloading a target only affects units that have a dependency on it, but does not affect manual activation. The checkdiskspace.timer does not need to be started using the sudo command, because the administrator is already running systemctl as root, as indicated by the # prompt. Reference: systemd.timer(5) - Linux manual page; systemctl(1) - Linux manual page

A Linux administrator wants to find out whether files from the wget package have been altered since they were installed. Which of the following commands will provide the correct information?

A.
rpm -i wget
A.
rpm -i wget
Answers
B.
rpm -qf wget
B.
rpm -qf wget
Answers
C.
rpm -F wget
C.
rpm -F wget
Answers
D.
rpm -V wget
D.
rpm -V wget
Answers
Suggested answer: D

Explanation:

The command that will provide the correct information about whether files from the wget package have been altered since they were installed is rpm -V wget. This command will use the rpm utility to verify an installed RPM package by comparing information about the installed files with information from the RPM database. The verification process can check various attributes of each file, such as size, mode, owner, group, checksum, capabilities, and so on. If any discrepancies are found, rpm will report them using a single letter code for each attribute.

The other options are not correct commands for verifying an installed RPM package. The rpm -i wget command is invalid because -i is used to install a package from a file, not to verify an installed package. The rpm -qf wget command will query which package owns wget as a file name or path name, but it will not verify its attributes. The rpm -F wget command will freshen (upgrade) an already installed package with wget as a file name or path name, but it will not verify its attributes. Reference: rpm(8) - Linux manual page; Using RPM to Verify Installed Packages

A Linux engineer set up two local DNS servers (10.10.10.10 and 10.10.10.20) and was testing email connectivity to the local mail server using the mail command on a local machine when the following error appeared:

The local machine DNS settings are:

Which of the following commands could the engineer use to query the DNS server to get mail server information?

A.
dig @example.com 10.10.10.20 a
A.
dig @example.com 10.10.10.20 a
Answers
B.
dig @10.10.10.20 example.com mx
B.
dig @10.10.10.20 example.com mx
Answers
C.
dig @example.com 10.10.10.20 ptr
C.
dig @example.com 10.10.10.20 ptr
Answers
D.
dig @10.10.10.20 example.com ns
D.
dig @10.10.10.20 example.com ns
Answers
Suggested answer: B

Explanation:

The command dig @10.10.10.20 example.com mx will query the DNS server to get mail server information. The dig command is a tool for querying DNS servers and displaying the results. The @ option specifies the DNS server to query, in this case 10.10.10.20. The mx option specifies the type of record to query, in this case mail exchange (MX) records, which identify the mail servers for a domain. The domain name to query is example.com. This command will show the MX records for example.com from the DNS server 10.10.10.20. This is the correct command to use to accomplish the task. The other options are incorrect because they either use the wrong syntax (@example.com 10.10.10.20 instead of @10.10.10.20 example.com), the wrong type of record (a or ptr instead of mx), or the wrong domain name (example.com ns instead of example.com mx). Reference: CompTIA Linux+ (XK0-005) Certification Study Guide, Chapter 13: Managing Network Services, page 415.

A Linux engineer has been notified about the possible deletion of logs from the file /opt/app/logs.

The engineer needs to ensure the log file can only be written into without removing previous entries.

Which of the following commands would be BEST to use to accomplish this task?

A.
chattr +a /opt/app/logs
A.
chattr +a /opt/app/logs
Answers
B.
chattr +d /opt/app/logs
B.
chattr +d /opt/app/logs
Answers
C.
chattr +i /opt/app/logs
C.
chattr +i /opt/app/logs
Answers
D.
chattr +c /opt/app/logs
D.
chattr +c /opt/app/logs
Answers
Suggested answer: A

Explanation:

The command chattr +a /opt/app/logs will ensure the log file can only be written into without removing previous entries. The chattr command is a tool for changing file attributes on Linux file systems. The +a option sets the append-only attribute, which means that the file can only be opened in append mode for writing. This prevents the file from being modified, deleted, or renamed. This is the best command to use to accomplish the task. The other options are incorrect because they either set the wrong attributes (+d, +i, or +c) or do not affect the file at all (-a). Reference: CompTIA Linux+ (XK0-005) Certification Study Guide, Chapter 11: Managing Files and Directories, page 357.

A systems administrator needs to check if the service systemd-resolved.service is running without any errors. Which of the following commands will show this information?

A.
systemctl status systemd-resolved.service
A.
systemctl status systemd-resolved.service
Answers
B.
systemctl enable systemd-resolved.service
B.
systemctl enable systemd-resolved.service
Answers
C.
systemctl mask systemd-resolved.service
C.
systemctl mask systemd-resolved.service
Answers
D.
systemctl show systemd-resolved.service
D.
systemctl show systemd-resolved.service
Answers
Suggested answer: A

Explanation:

The command systemctl status systemd-resolved.service will show the information about the service systemd-resolved.service. The systemctl command is a tool for managing system services and units. The status option displays the current status of a unit, such as active, inactive, or failed. The output also shows the unit description, loaded configuration, process ID, memory usage, and recent log messages. This command will show if the service systemd-resolved.service is running without any errors. This is the correct command to use to accomplish the task. The other options are incorrect because they either perform different actions (enable, mask, or show) or do not show the status of the service (systemctl show systemd-resolved.service only shows the properties of the service, not the status). Reference: CompTIA Linux+ (XK0-005) Certification Study Guide, Chapter 14: Managing Processes and Scheduling Tasks, page 427.

Junior system administrator had trouble installing and running an Apache web server on a Linux server. You have been tasked with installing the Apache web server on the Linux server and resolving the issue that prevented the junior administrator from running Apache.

INSTRUCTIONS

Install Apache and start the service. Verify that the Apache service is running with the defaults.

Typing "help" in the terminal will show a list of relevant event commands.

If at any time you would like to bring back the initial state of the simulation, please click the Reset All button.

A.
A.
Answers
Suggested answer: A

Explanation:

yum install httpd systemctl --now enable httpd systemctl status httpd netstat -tunlp | grep 80 pkill <processname> systemctl restart httpd systemctl status httpd

A Linux administrator needs to remove software from the server. Which of the following RPM options should be used?

A.
rpm -s
A.
rpm -s
Answers
B.
r?m -d
B.
r?m -d
Answers
C.
rpm -q
C.
rpm -q
Answers
D.
rpm -e
D.
rpm -e
Answers
Suggested answer: D

Explanation:

The RPM option -e should be used to remove software from the server. The rpm command is a tool for managing software packages on RPM-based Linux distributions. The -e option stands for erase and removes the specified package from the system. This is the correct option to use to accomplish the task. The other options are incorrect because they either do not exist (-s or -d) or do not remove software (-q stands for query and displays information about the package). Reference: CompTIA Linux+ (XK0-005) Certification Study Guide, Chapter 16: Managing Software, page 489.

A Linux system fails to start and delivers the following error message:

Which of the following commands can be used to address this issue?

A.
fsck.ext4 /dev/sda1
A.
fsck.ext4 /dev/sda1
Answers
B.
partprobe /dev/sda1
B.
partprobe /dev/sda1
Answers
C.
fdisk /dev/sda1
C.
fdisk /dev/sda1
Answers
D.
mkfs.ext4 /dev/sda1
D.
mkfs.ext4 /dev/sda1
Answers
Suggested answer: A

Explanation:

The command fsck.ext4 /dev/sda1 can be used to address the issue. The issue is caused by a corrupted filesystem on the /dev/sda1 partition. The error message shows that the filesystem type is ext4 and the superblock is invalid. The command fsck.ext4 is a tool for checking and repairing ext4 filesystems. The command will scan the partition for errors and attempt to fix them. This command can resolve the issue and allow the system to start. The other options are incorrect because they either do not fix the filesystem (partprobe or fdisk) or destroy the data on the partition (mkfs.ext4). Reference: CompTIA Linux+ (XK0-005) Certification Study Guide, Chapter 10: Managing Storage, page 325.

Based on an organization's new cybersecurity policies, an administrator has been instructed to ensure that, by default, all new users and groups that are created fall within the specified values below.

To which of the following configuration files will the required changes need to be made?

A.
/etc/login.defs
A.
/etc/login.defs
Answers
B.
/etc/security/limits.conf
B.
/etc/security/limits.conf
Answers
C.
/etc/default/useradd
C.
/etc/default/useradd
Answers
D.
/etc/profile
D.
/etc/profile
Answers
Suggested answer: A

Explanation:

The required changes need to be made to the /etc/login.defs configuration file. The /etc/login.defs file defines the default values for user and group IDs, passwords, shells, and other parameters for user and group creation. The file contains the directives UID_MIN, UID_MAX, GID_MIN, and GID_MAX, which set the minimum and maximum values for automatic user and group ID selection. The administrator can edit this file and change the values to match the organization's new cybersecurity policies. This is the correct file to modify to accomplish the task. The other options are incorrect because they either do not affect the user and group IDs (/etc/security/limits.conf or /etc/profile) or do not set the default values (/etc/default/useradd). Reference: CompTIA Linux+ (XK0-005) Certification Study Guide, Chapter 15:

Managing Users and Groups, page 463.

A Linux administrator is trying to remove the ACL from the file /home/user/dat a. txt but receives the following error message:

Given the following analysis:

Which of the following is causing the error message?

A.
The administrator is not using a highly privileged account.
A.
The administrator is not using a highly privileged account.
Answers
B.
The filesystem is mounted with the wrong options.
B.
The filesystem is mounted with the wrong options.
Answers
C.
SELinux file context is denying the ACL changes.
C.
SELinux file context is denying the ACL changes.
Answers
D.
File attributes are preventing file modification.
D.
File attributes are preventing file modification.
Answers
Suggested answer: D

Explanation:

File attributes are preventing file modification, which is causing the error message. The output of lsattr /home/user/data.txt shows that the file has the immutable attribute (i) set, which means that the file cannot be changed, deleted, or renamed. The command setfacl -b /home/user/data.txt tries to remove the ACL from the file, but fails because of the immutable attribute. The administrator needs to remove the immutable attribute first by using the command chattr -i /home/user/data.txt and then try to remove the ACL again. The other options are incorrect because they are not supported by the outputs. The administrator is using a highly privileged account, as shown by the # prompt. The filesystem is mounted with the correct options, as shown by the output of mount | grep /home. SELinux file context is not denying the ACL changes, as shown by the output of ls -Z /home/user/data.txt. Reference: CompTIA Linux+ (XK0-005) Certification Study Guide, Chapter 11: Managing Files and Directories, pages 357-358.

Total 371 questions
Go to page: of 38