ExamGecko
Home Home / CompTIA / XK0-005

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

Question list
Search
Search

List of questions

Search

Related questions











To harden one of the servers, an administrator needs to remove the possibility of remote administrative login via the SSH service. Which of the following should the administrator do?

A.
Add the line DenyUsers root to the /etc/hosts.deny file.
A.
Add the line DenyUsers root to the /etc/hosts.deny file.
Answers
B.
Set PermitRootLogin to no in the /etc/ssh/sshd_config file.
B.
Set PermitRootLogin to no in the /etc/ssh/sshd_config file.
Answers
C.
Add the line account required pam_nologin. so to the /etc/pam.d/sshd file.
C.
Add the line account required pam_nologin. so to the /etc/pam.d/sshd file.
Answers
D.
Set PubKeyAuthentication to no in the /etc/ssh/ssh_config file.
D.
Set PubKeyAuthentication to no in the /etc/ssh/ssh_config file.
Answers
Suggested answer: B

Explanation:

The administrator should set PermitRootLogin to no in the /etc/ssh/sshd_config file to remove the possibility of remote administrative login via the SSH service. The PermitRootLogin directive controls whether the root user can log in using SSH. Setting it to no will deny any remote login attempts by the root user. This will harden the server and prevent unauthorized access. The administrator should also restart the sshd service after making the change. The other options are incorrect because they either do not affect the SSH service (/etc/hosts.deny or /etc/pam.d/sshd) or do not prevent remote administrative login (PubKeyAuthentication). Reference: CompTIA Linux+ (XK0-005) Certification Study Guide, Chapter 13: Managing Network Services, page 413.

Which of the following is a function of a bootloader?

A.
It initializes all the devices that are required to load the OS.
A.
It initializes all the devices that are required to load the OS.
Answers
B.
It mounts the root filesystem that is required to load the OS.
B.
It mounts the root filesystem that is required to load the OS.
Answers
C.
It helps to load the different kernels to initiate the OS startup process.
C.
It helps to load the different kernels to initiate the OS startup process.
Answers
D.
It triggers the start of all the system services.
D.
It triggers the start of all the system services.
Answers
Suggested answer: C

Explanation:

A function of a bootloader is to help load the different kernels to initiate the OS startup process. A bootloader is a program that runs when the system is powered on and prepares the system for booting the OS. A bootloader can load different kernels, which are the core components of the OS, and pass the control to the selected kernel. A bootloader can also provide a menu for the user to choose which kernel or OS to boot. This is a correct function of a bootloader. The other options are incorrect because they are either functions of the kernel (initialize devices or mount root filesystem) or functions of the init system (trigger the start of system services). Reference: CompTIA Linux+ (XK0-005) Certification Study Guide, Chapter 8: Managing the Linux Boot Process, page 265.

A systems administrator configured firewall rules using firewalld. However, after the system is rebooted, the firewall rules are not present:

The systems administrator makes additional checks:

Which of the following is the reason the firewall rules are not active?

A.
iptables is conflicting with firewalld.
A.
iptables is conflicting with firewalld.
Answers
B.
The wrong system target is activated.
B.
The wrong system target is activated.
Answers
C.
FIREWALL_ARGS has no value assigned.
C.
FIREWALL_ARGS has no value assigned.
Answers
D.
The firewalld service is not enabled.
D.
The firewalld service is not enabled.
Answers
Suggested answer: D

Explanation:

The reason the firewall rules are not active is that the firewalld service is not enabled. This means that the service will not start automatically at boot time or after a system reload. To enable the firewalld service, the systems administrator needs to use the command sudo systemctl enable firewalld. This will create a symbolic link from the firewalld service file to the appropriate systemd target, such as multi-user.target. Enabling the service does not start it immediately, so the systems administrator also needs to use the command sudo systemctl start firewalld or sudo systemctl reload firewalld to activate the firewall rules.

The other options are not correct reasons for the firewall rules not being active. iptables is not conflicting with firewalld, because firewalld uses iptables as its backend by default. The wrong system target is not activated, because firewalld is independent of the system target and can be enabled for any target. FIREWALL_ARGS has no value assigned, but this is not a problem, because FIREWALL_ARGS is an optional environment variable that can be used to pass additional arguments to the firewalld daemon, such as --debug or --nofork. If FIREWALL_ARGS is empty or not defined, firewalld will use its default arguments. Reference: firewalld.service(8) - Linux manual page; firewallcmd(1) - Linux manual page; systemctl(1) - Linux manual page

A newly created container has been unable to start properly, and a Linux administrator is analyzing the cause of the failure. Which of the following will allow the administrator to determine the FIRST command that is executed inside the container right after it starts?

A.
docker export <container_id>
A.
docker export <container_id>
Answers
B.
docker info <container_id>
B.
docker info <container_id>
Answers
C.
docker start <container_id>
C.
docker start <container_id>
Answers
D.
docker inspect <container_id>
D.
docker inspect <container_id>
Answers
Suggested answer: D

Explanation:

The command that will allow the administrator to determine the first command that is executed inside the container right after it starts is docker inspect <container_id>. This command will display detailed information about the container, including its configuration, state, network settings, mounts, and logs. One of the configuration fields is "Entrypoint", which shows the command that is executed when the container is run. The entrypoint can be specified in the Dockerfile or overridden at runtime using the --entrypoint option.

The other options are not correct commands for determining the first command that is executed inside the container. The docker export <container_id> command will export the contents of the container's filesystem as a tar archive to STDOUT. This will not show the entrypoint of the container, but only its files. The docker info <container_id> command is invalid because docker info does not take any arguments. It shows system-wide information about Docker, such as the number of containers, images, volumes, networks, and storage drivers. The docker start <container_id> command will start a stopped container and attach its STDOUT and STDERR to the terminal. This will not show the entrypoint of the container, but only its output. Reference: docker inspect | Docker Docs; docker export | Docker Docs; docker info | Docker Docs; docker start | Docker Docs

A Linux administrator cloned an existing Linux server and built a new server from that clone. The administrator encountered the following error after booting the cloned server:

The administrator performed the commands listed below to further troubleshoot and mount the missing filesystem:

Which of the following should administrator use to resolve the device mismatch issue and mount the disk?

A.
mount disk by device-id
A.
mount disk by device-id
Answers
B.
fsck -A
B.
fsck -A
Answers
C.
mount disk by-label
C.
mount disk by-label
Answers
D.
mount disk by-blkid
D.
mount disk by-blkid
Answers
Suggested answer: A

Explanation:

The administrator should use the command mount disk by device-id to resolve the device mismatch issue and mount the disk. The issue is caused by the cloned server having a different device name for the disk than the original server. The output of blkid shows that the disk has the device name /dev/sdb1 on the cloned server, but the output of cat /etc/fstab shows that the disk is expected to have the device name /dev/sda1. The command mount disk by device-id will mount the disk by using its unique identifier (UUID) instead of its device name. The UUID can be obtained from the output of blkid or lsblk -f. The command will mount the disk to the specified mount point (/data) and resolve the issue. The other options are incorrect because they either do not mount the disk (fsck -A), do not use the correct identifier (mount disk by-label or mount disk by-blkid), or do not exist (mount disk by-blkid). Reference: CompTIA Linux+ (XK0-005) Certification Study Guide, Chapter 10: Managing Storage, pages 318-319.

A systems administrator installed a new software program on a Linux server. When the systems administrator tries to run the program, the following message appears on the screen.

Which of the following commands will allow the systems administrator to check whether the system supports virtualization?

A.
dmidecode -s system-version
A.
dmidecode -s system-version
Answers
B.
lscpu
B.
lscpu
Answers
C.
sysctl -a
C.
sysctl -a
Answers
D.
cat /sys/device/system/cpu/possible
D.
cat /sys/device/system/cpu/possible
Answers
Suggested answer: B

Explanation:

The command that will allow the systems administrator to check whether the system supports virtualization is lscpu. This command will display information about the CPU architecture, such as the number of CPUs, cores, sockets, threads, model name, frequency, cache size, and flags. One of the flags is vmx (for Intel processors) or svm (for AMD processors), which indicates that the CPU supports hardware virtualization. If the flag is present, it means that the system supports virtualization. If the flag is absent, it means that the system does not support virtualization or that it is disabled in the BIOS settings.

The other options are not correct commands for checking whether the system supports virtualization. The dmidecode -s system-version command will display the version of the system, such as the product name or serial number, but not the CPU information. The sysctl -a command will display all the kernel parameters, but not the CPU flags. The cat /sys/devices/system/cpu/possible command will display the range of possible CPUs that can be online or offline, but not the CPU features. Reference: lscpu(1) - Linux manual page; How To Check If Virtualization is Enabled in Windows 10 / 11

A Linux administrator created the directory /project/access2all. By creating this directory, the administrator is trying to avoid the deletion or modification of files from non-owners. Which of the following will accomplish this goal?

A.
chmod +t /project/access2all
A.
chmod +t /project/access2all
Answers
B.
chmod +rws /project/access2all
B.
chmod +rws /project/access2all
Answers
C.
chmod 2770 /project/access2all
C.
chmod 2770 /project/access2all
Answers
D.
chmod ugo+rwx /project/access2all
D.
chmod ugo+rwx /project/access2all
Answers
Suggested answer: A

Explanation:

The command that will accomplish the goal of avoiding the deletion or modification of files from non-owners is chmod +t /project/access2all. This command will set the sticky bit on the directory /project/access2all, which is a special permission that restricts file deletion or renaming to only the file owner, directory owner, or root user. This way, even if multiple users have write permission to the directory, they cannot delete or modify each other's files.

The other options are not correct commands for accomplishing the goal. The chmod +rws /project/access2all command will set both the SUID and SGID bits on the directory, which are special permissions that allow a program or a directory to run or be accessed with the permissions of its owner or group, respectively. However, this does not prevent file deletion or modification from nonowners.

The chmod 2770 /project/access2all command will set only the SGID bit on the directory, which means that any new files or subdirectories created in it will inherit its group ownership. However, this does not prevent file deletion or modification from non-owners. The chmod ugo+rwx /project/access2all command will grant read, write, and execute permissions to all users (user, group, and others) on the directory, which means that anyone can delete or modify any file in it. Reference: chmod(1) - Linux manual page; How to Use SUID, SGID, and Sticky Bits on Linux

A Linux systems administrator needs to persistently enable IPv4 forwarding in one of the Linux systems. Which of the following commands can be used together to accomplish this task? (Choose two.)

A.
sysctl net.ipv4.ip_forward
A.
sysctl net.ipv4.ip_forward
Answers
B.
sysctl -w net.ipv4.ip_forward=1
B.
sysctl -w net.ipv4.ip_forward=1
Answers
C.
echo "net.ipv4.ip_forward=1" >> /etc/sysctl.conf
C.
echo "net.ipv4.ip_forward=1" >> /etc/sysctl.conf
Answers
D.
echo 1 > /proc/sys/net/ipv4/ip_forward
D.
echo 1 > /proc/sys/net/ipv4/ip_forward
Answers
E.
sysctl -p
E.
sysctl -p
Answers
F.
echo "net.ipv6.conf.all.forwarding=l" >> /etc/sysctl.conf
F.
echo "net.ipv6.conf.all.forwarding=l" >> /etc/sysctl.conf
Answers
Suggested answer: B, E

Explanation:

The commands that can be used together to persistently enable IPv4 forwarding in one of the Linux systems are sysctl -w net.ipv4.ip_forward=1 and sysctl -p. The first command will use sysctl to write a new value (1) to the net.ipv4.ip_forward kernel parameter, which controls whether IP forwarding is enabled or disabled for IPv4. This will enable IP forwarding immediately without rebooting.

However, this change is temporary and will be lost after a reboot or a system reload. To make it permanent, we need to use the second command sysctl -p, which will load kernel parameters from /etc/sysctl.conf file. This file contains key-value pairs of kernel parameters and their values. To make sure that net.ipv4.ip_forward is set to 1 in this file, we can either edit it manually or append it using echo "net.ipv4.ip_forward=1" >> /etc/sysctl.conf.

The other options are not correct commands for persistently enabling IPv4 forwarding. The sysctl net.ipv4.ip_forward command will only display the current value of net.ipv4.ip_forward parameter, but not change it. The echo 1 > /proc/sys/net/ipv4/ip_forward command will write 1 to /proc/sys/net/ipv4/ip_forward file, which is another way to change net.ipv4.ip_forward parameter.

However, this change is also temporary and will not survive a reboot or a system reload. The echo "net.ipv6.conf.all.forwarding=l" >> /etc/sysctl.conf command will append a line to /etc/sysctl.conf file that sets net.ipv6.conf.all.forwarding parameter to 1. However, this parameter controls whether IP forwarding is enabled or disabled for IPv6, not IPv4. Reference: sysctl(8) - Linux manual page; Configure Linux as a Router (IP Forwarding)

Due to low disk space, a Linux administrator finding and removing all log files that were modified more than 180 days ago. Which of the following commands will accomplish this task?

A.
find /var/log -type d -mtime +180 -print -exec rm {} \;
A.
find /var/log -type d -mtime +180 -print -exec rm {} \;
Answers
B.
find /var/log -type f -modified +180 -rm
B.
find /var/log -type f -modified +180 -rm
Answers
C.
find /var/log -type f -mtime +180 -exec rm {} \
C.
find /var/log -type f -mtime +180 -exec rm {} \
Answers
D.
find /var/log -type c -atime +180 -remove
D.
find /var/log -type c -atime +180 -remove
Answers
Suggested answer: C

Explanation:

The command that will accomplish the task of finding and removing all log files that were modified more than 180 days ago is find /var/log -type f -mtime +180 -exec rm {} ;. This command will use find to search for files (-type f) under /var/log directory that have a modification time (-mtime) older than 180 days (+180). For each matching file, it will execute (-exec) the rm command to delete it, passing the file name as an argument ({}). The command will end with a semicolon (;), which is escaped with a backslash to prevent shell interpretation.

The other options are not correct commands for accomplishing the task. The find /var/log -type d -mtime +180 -print -exec rm {} ; command will search for directories (-type d) instead of files, and print their names (-print) before deleting them. This is not what the task requires. The find /var/log -type f -modified +180 -rm command is invalid because there is no such option as -modified or -rm for find. The correct options are -mtime and -delete, respectively. The find /var/log -type c -atime +180 -remove command is also invalid because there is no such option as -remove for find. Moreover, it will search for character special files (-type c) instead of regular files, and use access time (-atime) instead of modification time. Reference: find(1) - Linux manual page; Find and delete files older than n days in Linux

A junior administrator is setting up a new Linux server that is intended to be used as a router at a remote site. Which of the following parameters will accomplish this goal?

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

Explanation:

The parameter net.ipv4.ip_forward=1 will accomplish the goal of setting up a new Linux server as a router. This parameter enables the IP forwarding feature, which allows the server to forward packets between different network interfaces. This is necessary for a router to route traffic between different networks. The parameter can be set in the /etc/sysctl.conf file or by using the sysctl command. This is the correct parameter to use to accomplish the goal. The other options are incorrect because they either do not exist (net.ipv4.ip_forwarding or net.ipv4.ip_route) or do not enable IP forwarding (net.ipv4.ip_forward=0). Reference: CompTIA Linux+ (XK0-005) Certification Study Guide, Chapter 12: Managing Network Connections, page 382.

Total 371 questions
Go to page: of 38