ExamGecko
Home Home / CompTIA / XK0-005

CompTIA XK0-005 Practice Test - Questions Answers, Page 16

Question list
Search
Search

List of questions

Search

Related questions











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
A.
Removing the ExecStarWusr/sbin/webserver -D SOPTIONS from the service file
Answers
B.
Updating the Environment File line in the [Service] section to/home/webservice/config
B.
Updating the Environment File line in the [Service] section to/home/webservice/config
Answers
C.
Adding the User-webservice to the [Service] section of the service file
C.
Adding the User-webservice to the [Service] section of the service file
Answers
D.
Changing the:nulti-user.target in the [Install] section to basic.target
D.
Changing the:nulti-user.target in the [Install] section to basic.target
Answers
Suggested answer: C

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). Reference: CompTIA Linux+ (XK0-005) Certification Study Guide, Chapter 15: Managing System Services, page 458.

A Linux engineer receives reports that files created within a certain group are being modified by users who are not group members. The engineer wants to reconfigure the server so that only file owners and group members can modify new files by default. Which of the following commands would accomplish this task?

A.
chmod 775
A.
chmod 775
Answers
B.
umask. 002
B.
umask. 002
Answers
C.
chactr -Rv
C.
chactr -Rv
Answers
D.
chown -cf
D.
chown -cf
Answers
Suggested answer: B

Explanation:

The command umask 002 will accomplish the task of reconfiguring the server so that only file owners and group members can modify new files by default. The umask command is a tool for setting the default permissions for new files and directories on Linux systems. The umask value is a four-digit octal number that represents the permissions that are subtracted from the default permissions. The default permissions for files are 666, which means read and write for owner, group, and others. The default permissions for directories are 777, which means read, write, and execute for owner, group, and others. The umask value consists of four digits: the first digit is for special permissions, such as setuid, setgid, and sticky bit; the second digit is for the owner permissions; the third digit is for the group permissions; and the fourth digit is for the others permissions. The umask value can be calculated by subtracting the desired permissions from the default permissions. For example, if the desired permissions for files are 664, which means read and write for owner and group, and read for others, then the umask value is 002, which is 666 - 664. The command umask 002 will set the umask value to 002, which will ensure that only file owners and group members can modify new files by default. This is the correct command to use to accomplish the task. The other options are incorrect because they either do not set the default permissions for new files (chmod 775 or chown -cf) or do not exist (chattr -Rv). Reference: CompTIA Linux+ (XK0-005) Certification Study Guide, Chapter 11:

Managing File Permissions and Ownership, page 349.

A Linux administrator needs to connect securely to a remote server in order to install application software. Which of the following commands would allow this connection?

A.
scp "ABC-key.pem" [email protected]
A.
scp "ABC-key.pem" [email protected]
Answers
B.
sftp rooteiO.0.0.1
B.
sftp rooteiO.0.0.1
Answers
C.
telnet 10.0.0.1 80
C.
telnet 10.0.0.1 80
Answers
D.
ssh -i "ABC-key.pem" [email protected]
D.
ssh -i "ABC-key.pem" [email protected]
Answers
E.
sftp "ABC-key.pem" [email protected]
E.
sftp "ABC-key.pem" [email protected]
Answers
Suggested answer: D

Explanation:

The command ssh -i "ABC-key.pem" [email protected] would allow the administrator to connect securely to the remote server in order to install application software. The ssh command is a tool for establishing secure and encrypted connections between remote systems. The -i option specifies the identity file that contains the private key for key-based authentication. The "ABC-key.pem" is the name of the identity file that contains the private key. The [email protected] is the username and the IP address of the remote server. The command ssh -i "ABC-key.pem" [email protected] will connect to the remote server using the private key and allow the administrator to install application software. This is the correct command to use to connect securely to the remote server. The other options are incorrect because they either do not use key-based authentication (sftp [email protected] or telnet 10.0.0.1 80) or do not use the correct syntax for the command (scp "ABC-key.pem" [email protected] instead of scp -i "ABC-key.pem" [email protected] or sftp "ABC-key.pem" [email protected] instead of sftp -i "ABC-key.pem" [email protected]). Reference: CompTIA Linux+ (XK0-005) Certification Study Guide, Chapter 17: Implementing Basic Security, page 513.

A Linux administrator rebooted a server. Users then reported some of their files were missing. After doing some troubleshooting, the administrator found one of the filesystems was missing. The filesystem was not listed in /etc/f stab and might have been mounted manually by someone prior to reboot. Which of the following would prevent this issue from reoccurring in the future?

A.
Sync the mount units.
A.
Sync the mount units.
Answers
B.
Mount the filesystem manually.
B.
Mount the filesystem manually.
Answers
C.
Create a mount unit and enable it to be started at boot.
C.
Create a mount unit and enable it to be started at boot.
Answers
D.
Remount all the missing filesystems
D.
Remount all the missing filesystems
Answers
Suggested answer: C

Explanation:

The best way to prevent this issue from reoccurring in the future is to create a mount unit and enable it to be started at boot. A mount unit is a systemd unit that defines how and where a filesystem should be mounted. By creating a mount unit for the missing filesystem and enabling it with systemctl enable, the administrator can ensure that the filesystem will be automatically mounted at boot time, regardless of whether it is listed in /etc/fstab or not. Syncing the mount units will not prevent the issue, as it will only synchronize the state of existing mount units with /etc/fstab, not create new ones. Mounting the filesystem manually will not prevent the issue, as it will only mount the filesystem temporarily, not permanently. Remounting all the missing filesystems will not prevent the issue, as it will only mount the filesystems until the next reboot, not after. Reference: CompTIA Linux+ (XK0-005) Certification Study Guide, Chapter 14: Managing Disk Storage, page 457.

A systems administrator is encountering performance issues. The administrator runs 3 commands with the following output

The Linux server has the following system properties

CPU: 4 vCPU

Memory: 50GB

Which of the following accurately describes this situation?

A.
The system is under CPU pressure and will require additional vCPUs
A.
The system is under CPU pressure and will require additional vCPUs
Answers
B.
The system has been running for over a year and requires a reboot.
B.
The system has been running for over a year and requires a reboot.
Answers
C.
Too many users are currently logged in to the system
C.
Too many users are currently logged in to the system
Answers
D.
The system requires more memory
D.
The system requires more memory
Answers
Suggested answer: A

Explanation:

Based on the output of the image sent by the user, the system is under CPU pressure and will require additional vCPUs. The output shows that there are four processes running upload.sh scripts that are consuming a high percentage of CPU time (99.7%, 99.6%, 99.5%, and 99.4%). The output also shows that the system has only 4 vCPUs, which means that each process is using almost one entire vCPU.

This indicates that the system is struggling to handle the CPU load and may experience performance issues or slowdowns. Adding more vCPUs to the system would help to alleviate the CPU pressure and improve the system performance. The system has not been running for over a year, as the uptime command shows that it has been up for only 1 day, 2 hours, and 13 minutes. The number of users logged in to the system is not relevant to the performance issue, as they are not consuming significant CPU resources. The system does not require more memory, as the free command shows that it has plenty of available memory (49 GB total, 48 GB free). Reference: CompTIA Linux+ (XK0-005) Certification Study Guide, Chapter 15: Managing Memory and Process Execution, pages 468-469.

A Linux administrator has logged in to a server for the first time and needs to know which services are allowed through the firewall. Which of the following options will return the results for which the administrator is looking?

A.
firewall-cmd -get-services
A.
firewall-cmd -get-services
Answers
B.
firewall-cmd -check-config
B.
firewall-cmd -check-config
Answers
C.
firewall-cmd -list-services
C.
firewall-cmd -list-services
Answers
D.
systemctl status firewalld
D.
systemctl status firewalld
Answers
Suggested answer: C

Explanation:

The firewall-cmd --list-services command will return the results for which the administrator is looking. This command will list all services that are allowed through the firewall in the default zone or a specified zone. A service is a predefined set of ports and protocols that can be enabled or disabled by firewalld. The firewall-cmd --get-services command will list all available services that are supported by firewalld, not only those that are allowed through the firewall. The firewall-cmd --check-config command will check if firewalld configuration files are valid, not list services. The systemctl status firewalld command will display information about the firewalld service unit, such as its state, PID, memory usage, and logs, not list services. Reference: CompTIA Linux+ (XK0-005) Certification Study Guide, Chapter 18: Securing Linux Systems, page 543.

While inspecting a recently compromised Linux system, the administrator identified a number of processes that should not have been running:

Which of the following commands should the administrator use to terminate all of the identified processes?

A.
pkill -9 -f "upload*.sh"
A.
pkill -9 -f "upload*.sh"
Answers
B.
kill -9 "upload*.sh"
B.
kill -9 "upload*.sh"
Answers
C.
killall -9 -upload*.sh"
C.
killall -9 -upload*.sh"
Answers
D.
skill -9 "upload*.sh"
D.
skill -9 "upload*.sh"
Answers
Suggested answer: A

Explanation:

The pkill -9 -f "upload*.sh" command will terminate all of the identified processes. This command will send a SIGKILL signal (-9) to all processes whose full command line matches the pattern "upload*.sh" (-f). This signal will force the processes to terminate immediately without giving them a chance to clean up or save their state. The kill -9 "upload*.sh" command is invalid, as kill requires a process ID (PID), not a pattern. The killall -9 "upload*.sh" command is incorrect, as killall requires an exact process name, not a pattern. The skill -9 "upload*.sh" command is incorrect, as skill requires a username or a session ID (SID), not a pattern. Reference: CompTIA Linux+ (XK0-005) Certification Study Guide, Chapter 15: Managing Memory and Process Execution, page 470.

Which of the following commands is used to configure the default permissions for new files?

A.
setenforce
A.
setenforce
Answers
B.
sudo
B.
sudo
Answers
C.
umask
C.
umask
Answers
D.
chmod
D.
chmod
Answers
Suggested answer: C

Explanation:

The command that is used to configure the default permissions for new files is umask.

The umask command is a tool for setting the default permissions for new files and directories on Linux systems. The umask value is a four-digit octal number that represents the permissions that are subtracted from the default permissions. The default permissions for files are 666, which means read and write for owner, group, and others. The default permissions for directories are 777, which means read, write, and execute for owner, group, and others. The umask value consists of four digits: the first digit is for special permissions, such as setuid, setgid, and sticky bit; the second digit is for the owner permissions; the third digit is for the group permissions; and the fourth digit is for the others permissions. The umask value can be calculated by subtracting the desired permissions from the default permissions. For example, if the desired permissions for files are 664, which means read and write for owner and group, and read for others, then the umask value is 002, which is 666 - 664. The command umask 002 will set the umask value to 002, which will ensure that only file owners and group members can modify new files by default. The command that is used to configure the default permissions for new files is umask. This is the correct answer to the question. The other options are incorrect because they either do not set the default permissions for new files (setenforce, sudo, or chmod) or do not exist (kill -HUP or kill -TERM). Reference: CompTIA Linux+ (XK0-005) Certification Study Guide, Chapter 11: Managing File Permissions and Ownership, page 349.

During a security scan, the password of an SSH key file appeared to be too weak and was cracked.

Which of the following commands would allow a user to choose a stronger password and set it on the existing SSH key file?

A.
passwd
A.
passwd
Answers
B.
ssh
B.
ssh
Answers
C.
ssh-keygen
C.
ssh-keygen
Answers
D.
pwgen
D.
pwgen
Answers
Suggested answer: C

Explanation:

The command that would allow a user to choose a stronger password and set it on the existing SSH key file is ssh-keygen -p -f <keyfile>. This command uses the ssh-keygen tool, which is used to generate, manage, and convert authentication keys for SSH. The -p option stands for passphrase, and it allows the user to change or remove the passphrase of an existing private key file. The -f option specifies the filename of the key file. The command will prompt the user for the old passphrase, and then for the new passphrase twice.

The other options are not correct commands for changing the password of an SSH key file. The passwd command is used to change the password of a user account on a Linux system, not an SSH key file. The ssh command is used to log in to a remote system using SSH, not to change the password of an SSH key file. The pwgen command is used to generate random passwords, not to change the password of an SSH key file.

Reference: ssh-keygen(1) - Linux manual page; How To: Change Passphrase for SSH Private Key - Unix Tutorial

A Linux systems administrator is troubleshooting an I/O latency on a single CPU server. The administrator runs a top command and receives the following output:

%Cpu(s): 0.2 us, 33.1 sy, 0.0 ni, 0.0 id, 52.4 wa, 0.0 hi, 0.2 si, 0.0 st

Which of the following is correct based on the output received from the executed command?

A.
The server's CPU is taking too long to process users' requests.
A.
The server's CPU is taking too long to process users' requests.
Answers
B.
The server's CPU shows a high idle-time value.
B.
The server's CPU shows a high idle-time value.
Answers
C.
The server's CPU is spending too much time waiting for data inputs.
C.
The server's CPU is spending too much time waiting for data inputs.
Answers
D.
The server's CPU value for the time spent on system processes is low.
D.
The server's CPU value for the time spent on system processes is low.
Answers
Suggested answer: C

Explanation:

The server's CPU is spending too much time waiting for data inputs. This can be inferred from the output of the top command, which shows the percentage of CPU time spent in different states. The wa state stands for wait, and it indicates that the CPU is idle while waiting for an I/O operation to complete. In this case, the wa state is 52.4%, which means that more than half of the CPU time is wasted on waiting for data inputs. This can cause a high I/O latency and affect the performance of the server.

The other options are not correct based on the output received from the executed command. The server's CPU is not taking too long to process users' requests, because the us state, which stands for user, is only 0.2%, which means that the CPU is barely used by user processes. The server's CPU does not show a high idle-time value, because the id state, which stands for idle, is 0.0%, which means that the CPU is not idle at all. The server's CPU value for the time spent on system processes is not low, because the sy state, which stands for system, is 33.1%, which means that the CPU is heavily used by system processes.

Reference: How to Use the Linux top Command (and Understand Its Output); [Understanding Linux CPU Load - when should you be worried?]

Total 371 questions
Go to page: of 38