CompTIA Linux+ Certification XK0-005 Exam Practice Test

Page: 1 / 14
Total 487 questions
Question 1

Users have reported that the interactive sessions were lost on a Linux server. A Linux administrator verifies the server was switched to rescue.target mode for maintenance. Which of the following commands will restore the server to its usual target?



Answer : B

The systemct1 reboot command will restore the server to its usual target by rebooting it. This will cause the server to load the default target specified in /etc/systemd/system.conf or /etc/systemd/system/default.target files. The telinit 0 command would shut down the server, not restore it to its usual target. The systemct1 get-default command would display the default target, not change it. The systemct1 emergency command would switch the server to emergency.target mode, which is even more restrictive than rescue.target mode.:[CompTIA Linux+ (XK0-005) Certification Study Guide], Chapter 17: System Maintenance and Operation, page 516.


Question 2

A systems administrator created a new directory with specific permissions. Given the following output:

# file: comptia

# owner: root

# group: root

user: : rwx

group :: r-x

other: :---

default:user :: rwx

default:group :: r-x

default:group:wheel: rwx

default:mask :: rwx

default:other ::-

Which of the following permissions are enforced on /comptia?



Answer : A

The output shows the file access control list (FACL) of the /comptia directory, which is an extension of the standard Linux permissions that allows more fine-grained control over file and directory access1. The FACL consists of two parts: the access ACL and the default ACL.The access ACL applies to the current object, while the default ACL applies to the objects created within the directory2.

The access ACL has three entries: user, group, and other. These are similar to the standard Linux permissions, but they can be specified for individual users or groups as well. The user entry shows that the owner of the directory (root) has read, write, and execute permissions (rwx). The group entry shows that the group owner of the directory (root) has read and execute permissions (r-x). The other entry shows that all other users have no permissions (---).

The default ACL has five entries: user, group, group:wheel, mask, and other. These are applied to any files or directories created within /comptia. The user entry shows that the owner of the new object will have read, write, and execute permissions (rwx). The group entry shows that the group owner of the new object will have read and execute permissions (r-x). The group:wheel entry shows that the members of the wheel group will have read, write, and execute permissions (rwx) on the new object. The mask entry shows that the maximum permissions allowed for any user or group are read, write, and execute (rwx). The other entry shows that all other users will have no permissions (---) on the new object.

Therefore, based on the FACL output, members of the wheel group can read files in /comptia, as they have read permission on both the directory and any files within it. Option B is incorrect because the sticky bit is not set on /comptia or any files within it.The sticky bit is a special permission that prevents users from deleting or renaming files that they do not own in a shared directory3. It is symbolized by a t character in the execute position of others. Option C is incorrect because other users cannot create files in /comptia, as they have no permissions on the directory or any files within it. Option D is incorrect because root is not the only user who can create files in /comptia. Any user who has write permission on the directory can create files within it, such as members of the wheel group.


Question 3

A new application container was built with an incorrect version number. Which of the following commands should be used to rename the image to match the correct version 2.1.2?



Answer : A

The best command to use to rename the image to match the correct version 2.1.2 is A. docker tag comptia/app:2.1.1 comptia/app:2.1.2. This command will create a new tag for the existing image with the new version number, without changing the image content or ID. The other commands are either incorrect or not suitable for this task. For example:

B . docker push comptia/app:2.1.1 comptia/app:2.1.2 will try to push two images to a remote repository, but it does not rename the image locally.

C . docker rmi comptia/app:2.1.1 comptia/app:2.1.2 will try to remove two images from the local system, but it does not rename the image.

D . docker update comptia/app:2.1.1 comptia/app:2.1.2 will try to update the configuration of a running container, but it does not rename the image.


Question 4

A Linux administrator was informed that the server time zone is incorrect. Which of the following commands should the administrator use to correct the time zone?



Answer : A

In modern Linux distributions using systemd, the correct way to change the system time zone is by using the timedatectl command:

cpp

timedatectl set-timezone <TimeZone>

For example, to set the time zone to America/New_York, the command would be:

cpp

timedatectl set-timezone America/New_York

Why the other options are incorrect?

B . systemd-timezone set Asia/Tokyo Incorrect, as there is no systemd-timezone command in Linux.

C . systemctl configure-timezone Africa/Nairobi Incorrect, systemctl does not have a configure-timezone option.

D . tzconfig configure Europe/London Incorrect, tzconfig was used in older Debian-based systems, but it has been deprecated in favor of timedatectl.

:

CompTIA Linux+ Official Documentation

timedatectl Documentation -- Red Hat


Question 5

A systems administrator is checking the system logs. The administrator wants to look at the last 20 lines of a log. Which of the following will execute the command?



Answer : B

The commandtail -n 20will display the last 20 lines of a file. The-noption specifies the number of lines to show. This is the correct command to execute the task. The other options are incorrect because they either use the wrong options (-v,-c, or-l) or have the wrong arguments (20instead of20 filename).:CompTIA Linux+ (XK0-005) Certification Study Guide, Chapter 11: Managing Files and Directories, page 352.


Question 6

A systems administrator is installing various software packages using a pack-age manager. Which of the following commands would the administrator use on the Linux server to install the package?



Answer : D


Question 7

A systems administrator is working on an SFTP server configuration. Which of the following commands will best enable the connectivity to that service from the 10.10.0.0/24 network?



Answer : A

To allow SFTP (which uses port 22, same as SSH) from a specific subnet using UFW, the most specific and correct syntax is:

bash

sudo ufw allow from 10.10.0.0/24 to any port 22

This allows traffic from a specific subnet to port 22, which is what's required.

Option B allows traffic on an interface but is not limited to the subnet.

Option C is incomplete --- it allows all ports from the subnet.

Option D is malformed syntax --- 0:22/tcp is not a valid port range or UFW format.


''UFW rules can be configured to restrict access by IP range and port. For SFTP, allow port 22 specifically from the required subnet.''

Page:    1 / 14   
Total 487 questions