CompTIA XK0-005 Practice Test - Questions Answers, Page 23
List of questions
Question 221

The administrator comptia is not able to perform privileged functions on a newly deployed system. Given the following command outputs:
Which of the following is the reason that the administrator is unable to perform the assigned duties?
Explanation:
The reason that the administrator is unable to perform the assigned duties is because the administrator is not a part of the correct group. This is option B.
Based on the image that you sent, I can see that the user comptia has a user ID and a group ID of 1000, and belongs to only one group, which is also comptia. However, the sudoers file, which defines the permissions for users to run commands as root or other users, does not include the comptia group in any of the entries. Therefore, the user comptia cannot use sudo to perform privileged functions on the system.
The other options are incorrect because:
A) The administrator needs a password reset.
This is not true, because the password aging information for the user comptia shows that the password was last changed on Oct 24, 2023, and it does not expire until Jan 22, 2024. There is no indication that the password is locked or expired.
C) The administrator did not update the sudo database.
This is not necessary, because the sudo database is automatically updated whenever the sudoers file is modified. There is no separate command to update the sudo database.
D) The administrator's credentials need to be more complex.
This is not relevant, because the complexity of the credentials does not affect the ability to use sudo. The sudoers file does not specify any password policy for the users or groups that are allowed to use sudo.
Question 222

A Linux administrator intends to start using KVM on a Linux server. Which of the following commands will allow the administrator to load the KVM module as well as any related dependencies?
Explanation:
This command will load the KVM module as well as any related dependencies, such as kvm-intel or kvm-amd, depending on the processor type. The modprobe command is a Linux utility that reads the /etc/modules.conf file and adds or removes modules from the kernel. It also resolves any dependencies between modules, so that they are loaded in the correct order.
The other options are incorrect because:
B) insmod kvm
This command will only load the KVM module, but not any related dependencies. The insmod command is a low-level Linux utility that inserts a single module into the kernel. It does not resolve any dependencies between modules, so they have to be loaded manually.
C) depmod kvm
This command will not load the KVM module at all, but only create a list of module dependencies for modprobe to use. The depmod command is a Linux utility that scans the installed modules and generates a file called modules.dep that contains dependency information for each module.
D) hotplug kvm
This command is invalid and does not exist. The hotplug mechanism is a feature of the Linux kernel that allows devices to be added or removed while the system is running. It does not have anything to do with loading modules.
Question 223

A systems administrator received a request to change a user's credentials. Which of the following commands will grant the request?
Explanation:
This command will allow the systems administrator to change the password of another user account in the system. The sudo prefix will grant the administrator the necessary privileges to perform this action, and the passwd command will prompt for the new password for the specified user. For example, if the administrator wants to change the password of a user named tom, the command will look like this:
sudo passwd tom
The other options are incorrect because:
B) sudo userdel
This command will delete a user account from the system, not change its credentials. The userdel command removes the user's entry from the /etc/passwd and /etc/shadow files, as well as deletes the user's home directory and mail spool. This is not what the request asked for.
C) sudo chage
This command will change the password expiration and aging information for a user account, not its credentials. The chage command can be used to set or modify various parameters related to password aging, such as the minimum and maximum number of days between password changes, the number of days before password expiration to issue a warning, and so on. This is not what the request asked for.
D) sudo usermod
This command will modify various attributes of a user account, such as its login name, home directory, default shell, primary group, and so on. However, it cannot change the user's password directly. To do that, the usermod command requires the -p option followed by an encrypted password string, which is not easy to generate manually. Therefore, this is not a practical way to change a user's credentials.
How to Change Account Passwords on Linux
How to Change a Password in Linux for Root and Other Users
CompTIA Linux+ Certification Exam Objectives
Question 224

Application code is stored in Git. Due to security concerns, the DevOps engineer does not want to keep a sensitive configuration file, app . conf, in the repository. Which of the following should the engineer do to prevent the file from being uploaded to the repository?
Explanation:
This will prevent the file app.conf from being tracked by Git and uploaded to the repository. The .gitignore file is a special file that contains patterns of files and directories that Git should ignore. Any file that matches a pattern in the .gitignore file will not be staged, committed, or pushed to the remote repository. The .gitignore file should be placed in the root directory of the repository and committed along with the other files.
The other options are incorrect because:
A) Run git exclude app.conf
This is not a valid Git command. There is no such thing as git exclude. The closest thing is git update-index --assume-unchanged, which tells Git to temporarily ignore changes to a file, but it does not prevent the file from being uploaded to the repository.
B) Run git stash app.conf
This will temporarily save the changes to the file app.conf in a stash, which is a hidden storage area for uncommitted changes. However, this does not prevent the file from being tracked by Git or uploaded to the repository. The file will still be part of the working tree and the index, and it will be restored when the stash is popped or applied.
C) Add app.conf to .exclude
This will have no effect, because Git does not recognize a file named .exclude. The only files that Git uses to ignore files are .gitignore, $GIT_DIR/info/exclude, and core.excludesFile.
Git - gitignore Documentation
.gitignore file - ignoring files in Git | Atlassian Git Tutorial
Ignoring files - GitHub Docs
[CompTIA Linux+ Certification Exam Objectives]
Question 225

A systems administrator is enabling LUKS on a USB storage device with an ext4 filesystem format. The administrator runs dmesg and notices the following output:
Given this scenario, which of the following should the administrator perform to meet these requirements? (Select three).
Explanation:
To enable LUKS on a USB storage device with an ext4 filesystem format, the administrator needs to perform the following steps:
Unmount the device if it is mounted usingumount /dev/sdc(D)
Create a partition table on the device usingfdisk /dev/sdc(E)
Format the partition with LUKS encryption usingcryptsetup luksFormat /dev/sdc1(H)
Open the encrypted partition usingcryptsetup luksOpen /dev/sdc1 LUKS0001
Create an ext4 filesystem on the encrypted partition usingmkfs.ext4 /dev/mapper/LUKS0001
Mount the encrypted partition usingmount /dev/mapper/LUKS0001 /mntReference:
[CompTIA Linux+ Study Guide], Chapter 9: Securing Linux, Section: Encrypting Disks
[How to Encrypt USB Drive on Ubuntu 18.04]
Question 226

Which of the following actions are considered good security practices when hardening a Linux server? (Select two).
Explanation:
Some good security practices when hardening a Linux server are:
Removing unnecessary packages (B) to reduce the attack surface and eliminate potential vulnerabilities
Disabling the SSH root login possibility (E) to prevent unauthorized access and brute-force attacks on the root accountReference:
[CompTIA Linux+ Study Guide], Chapter 9: Securing Linux, Section: Hardening Linux
[How to Harden Your Linux Server]
Question 227

A new disk was presented to a server as /dev/ sdd. The systems administrator needs to check if a partition table is on that disk. Which of the following commands can show this information?
Explanation:
The command that can be used to check if a partition table is on a disk isfdisk. Thefdiskcommand can display, create, delete, and modify partitions on a disk. To show the partition table of a disk, the administrator can usefdisk -l /dev/sdd(B).Reference:
[CompTIA Linux+ Study Guide], Chapter 5: Managing Filesystems and Logical Volumes, Section: Partitioning Disks
[How to Use Fdisk Command in Linux]
Question 228

A systems administrator wants to check for running containers. Which of the following commands can be used to show this information?
Explanation:
The command that can be used to check for running containers isdocker ps. Thedocker pscommand can list all the containers that are currently running on the system. To show all the containers, including those that are stopped, the administrator can usedocker ps -a.Reference:
[CompTIA Linux+ Study Guide], Chapter 11: Working with Containers, Section: Managing Containers with Docker
[Docker PS Command with Examples]
Question 229

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?
Question 230

A user created the following script file:
# ! /bin/bash
# FILENAME: /home/user/ script . sh
echo 'hello world'
exit 1
However, when the user tried to run the script file using the command 'script . sh, an error returned indicating permission was denied. Which of the follow-ing should the user execute in order for the script to run properly?
Explanation:
To run a script file, the user needs to have execute permission on the file. The commandchmod u+x /home/user/script.sh(A) will grant execute permission to the owner of the file, which is the user who created it. The other commands will not give execute permission to the user, and therefore will not allow the script to run properly.Reference:
[CompTIA Linux+ Study Guide], Chapter 3: Working with Files, Section: Changing File Permissions
[How to Make a Bash Script Executable]
Question