ExamGecko
Home Home / CompTIA / XK0-005

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

Question list
Search
Search

List of questions

Search

Related questions











Some servers in an organization have been compromised. Users are unable to access to the organization's web page and other services. While reviewing the system log, a systems administrator notices messages from the kernel regarding firewall rules:

Which of the following commands will remediate and help resolve the issue?

A.
A.
Answers
B.
B.
Answers
C.
C.
Answers
D.
D.
Answers
Suggested answer: A

Explanation:

The command iptables -F will remediate and help resolve the issue. The issue is caused by the firewall rules that block the access to the organization's web page and other services. The output of dmesg | grep firewall shows that the kernel has dropped packets from the source IP address 192.168.1.100 to the destination port 80, which is the default port for HTTP. The command iptables -F will flush all the firewall rules and allow the traffic to pass through. This command will resolve the issue and restore the access to the web page and other services. The other options are incorrect because they either do not affect the firewall rules (ip route flush or ip addr flush) or do not exist (iptables -R). Reference: CompTIA Linux+ (XK0-005) Certification Study Guide, Chapter 18: Securing Linux Systems, page 543.

A junior administrator is trying to set up a passwordless SSH connection to one of the servers. The administrator follows the instructions and puts the key in the authorized_key file at the server, but the administrator is still asked to provide a password during the connection.

Given the following output:

Which of the following commands would resolve the issue and allow an SSH connection to be established without a password?

A.
restorecon -rv .ssh/authorized_key
A.
restorecon -rv .ssh/authorized_key
Answers
B.
mv .ssh/authorized_key .ssh/authorized_keys
B.
mv .ssh/authorized_key .ssh/authorized_keys
Answers
C.
systemctl restart sshd.service
C.
systemctl restart sshd.service
Answers
D.
chmod 600 mv .ssh/authorized_key
D.
chmod 600 mv .ssh/authorized_key
Answers
Suggested answer: B

Explanation:

The command mv .ssh/authorized_key .ssh/authorized_keys will resolve the issue and allow an SSH connection to be established without a password. The issue is caused by the incorrect file name of the authorized key file on the server. The file should be named authorized_keys, not authorized_key.

The mv command will rename the file and fix the issue. The other options are incorrect because they either do not affect the file name (restorecon or chmod) or do not restart the SSH service (systemctl). Reference: CompTIA Linux+ (XK0-005) Certification Study Guide, Chapter 13: Managing Network Services, page 410.

A Linux administrator needs to resolve a service that has failed to start. The administrator runs the following command:

The following output is returned

Which of the following is MOST likely the issue?

A.
The service does not have permissions to read write the startupfile.
A.
The service does not have permissions to read write the startupfile.
Answers
B.
The service startupfile size cannot be 81k.
B.
The service startupfile size cannot be 81k.
Answers
C.
The service startupfile cannot be owned by root.
C.
The service startupfile cannot be owned by root.
Answers
D.
The service startupfile should not be owned by the root group.
D.
The service startupfile should not be owned by the root group.
Answers
Suggested answer: A

Explanation:

The most likely issue is that the service does not have permissions to read or write the startupfile. The output of systemctl status startup.service shows that the service has failed to start and the error message is "Permission denied". The output of ls -l /etc/startupfile shows that the file has the permissions -rw-r--r--, which means that only the owner (root) can read and write the file, while the group (root) and others can only read the file. The service may not run as root and may need write access to the file. The administrator should change the permissions of the file by using the chmod command and grant write access to the group or others, or change the owner or group of the file by using the chown command and assign it to the user or group that runs the service. The other options are incorrect because they are not supported by the outputs. The file size, owner, and group are not the causes of the issue. Reference: CompTIA Linux+ (XK0-005) Certification Study Guide, Chapter 11: Managing Files and Directories, pages 345-346.

A Linux engineer is setting the sticky bit on a directory called devops with 755 file permission. Which of the following commands will accomplish this task?

A.
chown -s 755 devops
A.
chown -s 755 devops
Answers
B.
chown 1755 devops
B.
chown 1755 devops
Answers
C.
chmod -s 755 devops
C.
chmod -s 755 devops
Answers
D.
chmod 1755 devops
D.
chmod 1755 devops
Answers
Suggested answer: D

Explanation:

The command that will set the sticky bit on a directory called devops with 755 file permission is chmod 1755 devops. This command will use chmod to change the mode of the directory devops to 1755, which means that the owner has read, write, and execute permissions (7), the group has read and execute permissions (5), and others have read and execute permissions (5). The first digit 1 indicates that the sticky bit is set on the directory, which is a special permission that prevents users from deleting or renaming files in the directory that they do not own.

The other options are not correct commands for setting the sticky bit on a directory. The chown -s 755 devops command is invalid because chown is used to change the owner and group of files or directories, not their permissions. The -s option for chown is used to remove a symbolic link, not to set the sticky bit. The chown 1755 devops command is also invalid because chown does not accept numeric arguments for changing permissions. The chmod -s 755 devops command will remove the sticky bit from the directory devops, not set it. Reference: chmod(1) - Linux manual page; How to Use SUID, SGID, and Sticky Bits on Linux

A Linux administrator booted up the server and was presented with a non-GUI terminal. The administrator ran the command systemctl isolate graphical.target and rebooted the system by running systemctl reboot, which fixed the issue. However, the next day the administrator was presented again with a non-GUI terminal. Which of the following is the issue?

A.
The administrator did not reboot the server properly.
A.
The administrator did not reboot the server properly.
Answers
B.
The administrator did not set the default target to basic.target.
B.
The administrator did not set the default target to basic.target.
Answers
C.
The administrator did not set the default target to graphical.target.
C.
The administrator did not set the default target to graphical.target.
Answers
D.
The administrator did not shut down the server properly.
D.
The administrator did not shut down the server properly.
Answers
Suggested answer: C

Explanation:

The issue is that the administrator did not set the default target to graphical.target. A target is a unit of systemd that groups together other units by a common purpose or state. The graphical.target is a target that starts the graphical user interface (GUI) along with other services. The administrator used the command systemctl isolate graphical.target to switch to this target temporarily, but this does not change the default target that is activated at boot time. To make this change permanent, the administrator should have used the command systemctl set-default graphical.target, which creates a symbolic link from /etc/systemd/system/default.target to /usr/lib/systemd/system/graphical.target.

The other options are not correct explanations for the issue. The administrator did reboot the server properly by using systemctl reboot, which shuts down and restarts the system cleanly. The administrator did not need to set the default target to basic.target, which is a minimal target that only starts essential services. The administrator did not shut down the server improperly, which could have caused file system corruption or data loss, but not affect the default target. Reference: systemctl(1) - Linux manual page; How to Change Runlevels (targets) in SystemD

Users report that connections to a MariaDB service are being closed unexpectedly. A systems administrator troubleshoots the issue and finds the following message in /var/log/messages:

Which of the following is causing the connection issue?

A.
The process mysqld is using too many semaphores.
A.
The process mysqld is using too many semaphores.
Answers
B.
The server is running out of file descriptors.
B.
The server is running out of file descriptors.
Answers
C.
Something is starving the server resources.
C.
Something is starving the server resources.
Answers
D.
The amount of RAM allocated to the server is too high.
D.
The amount of RAM allocated to the server is too high.
Answers
Suggested answer: B

Explanation:

The message in /var/log/messages indicates that the server is running out of file descriptors. A file descriptor is a non-negative integer identifier for an open file in Linux. Each process has a table of open file descriptors where a new entry is appended upon opening a new file. There is a limit on how many file descriptors a process can open at a time, which depends on the system configuration and the user privileges. If a process tries to open more files than the limit, it will fail with an error message like "Too many open files". This could cause connections to be closed unexpectedly or other problems with the application.

The other options are not correct causes for the connection issue. The process mysqld is not using too many semaphores, which are synchronization mechanisms for processes that share resources. Semaphores are not related to file descriptors or open files. Something is not starving the server resources, which could mean high CPU usage, memory pressure, disk I/O, network congestion, or other factors that affect performance. These could cause slowdowns or timeouts, but not file descriptor exhaustion. The amount of RAM allocated to the server is not too high, which could cause swapping or paging if it exceeds the physical memory available. This could also affect performance, but not file descriptor availability. Reference: File Descriptor Requirements (Linux Systems); Limits on the Number of Linux File Descriptors

A developer is trying to install an application remotely that requires a graphical interface for installation. The developer requested assistance to set up the necessary environment variables along with X11 forwarding in SSH. Which of the following environment variables must be set in remote shell in order to launch the graphical interface?

A.
$RHOST
A.
$RHOST
Answers
B.
SETENV
B.
SETENV
Answers
C.
$SHELL
C.
$SHELL
Answers
D.
$DISPLAY
D.
$DISPLAY
Answers
Suggested answer: D

Explanation:

The environment variable that must be set in remote shell in order to launch the graphical interface is $DISPLAY. This variable tells X11 applications where to display their windows on screen. It usually has the form hostname:displaynumber.screennumber, where hostname is the name of the computer running the X server, displaynumber is a unique identifier for an X display on that computer, and screennumber is an optional identifier for a screen within an X display. For example, localhost:0.0 means display number 0 on the local host. If the hostname is omitted, it defaults to the local host.

The other options are not correct environment variables for launching the graphical interface.

$RHOST is a variable that stores the name of the remote host, but it is not used by X11 applications. SETENV is a command that sets environment variables in some shells, but it is not an environment variable itself. $SHELL is a variable that stores the name of the current shell, but it is not related to X11 forwarding. Reference: How to enable or disable X11 forwarding in an SSH server; How to Configure X11 Forwarding Using SSH In Linux

A systems administrator is implementing a new service task with systems at startup and needs to execute a script entitled test.sh with the following content:

The administrator tries to run the script after making it executable with chmod +x; however, the script will not run. Which of the following should the administrator do to address this issue? (Choose two.)

A.
Add #!/bin/bash to the bottom of the script.
A.
Add #!/bin/bash to the bottom of the script.
Answers
B.
Create a unit file for the new service in /etc/systemd/system/ with the name helpme.service in the location.
B.
Create a unit file for the new service in /etc/systemd/system/ with the name helpme.service in the location.
Answers
C.
Add #!//bin/bash to the top of the script.
C.
Add #!//bin/bash to the top of the script.
Answers
D.
Restart the computer to enable the new service.
D.
Restart the computer to enable the new service.
Answers
E.
Create a unit file for the new service in /etc/init.d with the name helpme.service in the location.
E.
Create a unit file for the new service in /etc/init.d with the name helpme.service in the location.
Answers
F.
Shut down the computer to enable the new service.
F.
Shut down the computer to enable the new service.
Answers
Suggested answer: B, C

Explanation:

The administrator should do the following two things to address the issue:

Add #!/bin/bash to the top of the script. This is called a shebang line and it tells the system which interpreter to use to execute the script. Without this line, the script will not run properly. The shebang line should be the first line of the script and should start with #! followed by the path to the interpreter. In this case, the interpreter is bash and the path is /bin/bash. The other option (A) is incorrect because the shebang line should be at the top, not the bottom of the script.

Create a unit file for the new service in /etc/systemd/system/ with the name helpme.service in the location. This is necessary to register the script as a systemd service and enable it to run at startup. A unit file is a configuration file that defines the properties and behavior of a service, such as the description, dependencies, start and stop commands, and environment variables. The unit file should have the extension .service and should be placed in the /etc/systemd/system/ directory. The other option (E) is incorrect because /etc/init.d is the directory for init scripts, not systemd services.

Reference: CompTIA Linux+ (XK0-005) Certification Study Guide, Chapter 14: Managing Processes and Scheduling Tasks, pages 429-430.

A Linux administrator needs to correct the permissions of a log file on the server. Which of the following commands should be used to set filename.log permissions to -rwxr--r--. ?

A.
chmod 755 filename.log
A.
chmod 755 filename.log
Answers
B.
chmod 640 filename.log
B.
chmod 640 filename.log
Answers
C.
chmod 740 filename.log
C.
chmod 740 filename.log
Answers
D.
chmod 744 filename.log
D.
chmod 744 filename.log
Answers
Suggested answer: A

Explanation:

The command chmod 755 filename.log should be used to set filename.log permissions to -rwxr--r--.

The chmod command is a tool for changing file permissions on Linux file systems. The permissions can be specified in octal notation, where each digit represents the permissions for the owner, group, and others respectively. The permissions are encoded as follows:

0: no permission

1: execute permission

2: write permission

4: read permission

5: read and execute permissions (4 + 1)

6: read and write permissions (4 + 2)

7: read, write, and execute permissions (4 + 2 + 1)

The command chmod 755 filename.log will set the permissions to -rwxr--r--, which means that the owner has read, write, and execute permissions (7), the group has read and execute permissions (5), and others have read and execute permissions (5). This is the correct command to use to accomplish the task. The other options are incorrect because they either set the wrong permissions (chmod 640, chmod 740, or chmod 744) or do not exist (chmod -G). Reference: CompTIA Linux+ (XK0-005) Certification Study Guide, Chapter 11: Managing Files and Directories, page 345.

After listing the properties of a system account, a systems administrator wants to remove the expiration date of a user account. Which of the following commands will accomplish this task?

A.
chgrp system accountname
A.
chgrp system accountname
Answers
B.
passwd -s accountname
B.
passwd -s accountname
Answers
C.
chmod -G system account name
C.
chmod -G system account name
Answers
D.
chage -E -1 accountname
D.
chage -E -1 accountname
Answers
Suggested answer: D

Explanation:

The command chage -E -1 accountname will accomplish the task of removing the expiration date of a user account. The chage command is a tool for changing user password aging information on Linux systems. The -E option sets the expiration date of the user account, and the -1 value means that the account will never expire. The command chage -E -1 accountname will remove the expiration date of the user account named accountname. This is the correct command to use to accomplish the task.

The other options are incorrect because they either do not affect the expiration date (chgrp, passwd, or chmod) or do not exist (chmod -G). Reference: CompTIA Linux+ (XK0-005) Certification Study Guide, Chapter 15: Managing Users and Groups, page 467.

Total 371 questions
Go to page: of 38