Black Friday Special Limited Time 70% Discount Offer - Ends in 0d 00h 00m 00s - Coupon code: 70special

CompTIA XK0-005 CompTIA Linux+ Exam Exam Practice Test

Page: 1 / 38
Total 376 questions

CompTIA Linux+ Exam Questions and Answers

Testing Engine

  • Product Type: Testing Engine
$37.5  $124.99

PDF Study Guide

  • Product Type: PDF Study Guide
$33  $109.99
Question 1

A systems administrator created a new Docker image called test. After building the image, the administrator forgot to version the release. Which of the following will allow the administrator to assign the v1 version to the image?

Options:

A.

docker image save test test:v1

B.

docker image build test:vl

C.

docker image tag test test:vl

D.

docker image version test:v1

Question 2

A cloud engineer needs to change the secure remote login port from 22 to 49000. Which of the following files should the engineer modify to change the port number to the desired value?

Options:

A.

/etc/host.conf

B.

/etc/hostname

C.

/etc/services

D.

/etc/ssh/sshd_config

Question 3

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?

Options:

A.

chmod +t /project/access2all

B.

chmod +rws /project/access2all

C.

chmod 2770 /project/access2all

D.

chmod ugo+rwx /project/access2all

Question 4

A Linux administrator logs in to a system and identifies that an important backup has been started. The backup process is consuming a considerable amount of CPU time but needs to continue. Which of the following should the administrator use to reduce the impact this process has on other services?

Options:

A.

renice -n 15 -p

B.

nice -n 15 -p

C.

renice -n -15 -p

D.

nice -n -15 -p

Question 5

A Linux administrator is troubleshooting SSH connection issues from one of the workstations.

When users attempt to log in from the workstation to a server with the IP address 104.21.75.76, they receive the following message:

The administrator reviews the information below:

Which of the following is causing the connectivity issue?

Options:

A.

The workstation has the wrong IP settings.

B.

The sshd service is disabled.

C.

The server’s firewall is preventing connections from being made.

D.

The server has an incorrect default gateway configuration.

Question 6

While troubleshooting server issues, a Linux systems administrator obtains the following output:

[rootGhost ~]# totalfree -m usedfreesharedbuf f/cache available

Mem:373635988824829

Swap:20471824223

Which of the following best describes the state of the system?

Options:

A.

The system has consumed the system memory and swap space.

B.

The system has enough free memory space.

C.

The system has swap disabled.

D.

The system has allocated enough buffer space.

Question 7

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?

Options:

A.

The administrator needs a password reset.

B.

The administrator is not a part of the correct group.

C.

The administrator did not update the sudo database.

D.

The administrator's credentials need to be more complex.

Question 8

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?

Options:

A.

Removing the ExecStarWusr/sbin/webserver -D SOPTIONS from the service file

B.

Updating the Environment File line in the [Service] section to/home/webservice/config

C.

Adding the User-webservice to the [Service] section of the service file

D.

Changing the:nulti-user.target in the [Install] section to basic.target

Question 9

A systems administrator frequently connects to a remote host via SSH and a non-standard port. The systems administrator would like to avoid passing the port parameter on the command line every time. Which of the following files can be used to set a different port value for that host?

Options:

A.

/etc/ssh/sshd_config

B.

/etc/ssh/moduli

C.

~/.ssh/config

D.

~/.ssh/authorized_keys

Question 10

A Linux administrator is troubleshooting the root cause of a high CPU load and average.

Which of the following commands will permanently resolve the issue?

Options:

A.

renice -n -20 6295

B.

pstree -p 6295

C.

iostat -cy 1 5

D.

kill -9 6295

Question 11

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?

Options:

A.

chown -s 755 devops

B.

chown 1755 devops

C.

chmod -s 755 devops

D.

chmod 1755 devops

Question 12

A user reported issues when trying to log in to a Linux server. The following outputs were received:

Given the outputs above. which of the following is the reason the user is una-ble to log in to the server?

Options:

A.

User1 needs to set a long password.

B.

User1 is in the incorrect group.

C.

The user1 shell assignment incorrect.

D.

The user1 password is expired.

Question 13

A systems administrator creates a public key for authentication. Which of the following tools is most suitable to use when uploading the key to the remote

servers?

Options:

A.

scp

B.

ssh-copy-id

C.

ssh-agent

D.

ssh-keyscan

Question 14

A systems administrator identifies multiple processes in a zombie state. Which of the following signals would be best for the administrator to send to the PPID?

Options:

A.

SIGTERM

B.

SIGHUP

C.

SIGQUIT

D.

SIGSTOP

Question 15

A Linux administrator found many containers in an exited state. Which of the following commands will allow the administrator to clean up the containers in an exited state?

Options:

A.

docker rm --all

B.

docker rm $(docker ps -aq)

C.

docker images prune *

D.

docker rm --state exited

Question 16

A developer needs to launch an Nginx image container, name it Web001, and ex-pose port 8080 externally while mapping to port 80 inside the container. Which of the following commands will accomplish this task?

Options:

A.

docker exec —it -p 8080: 80 ——name Web001 nginx

B.

docker load -it -p 8080:80 ——name Web001 nginx

C.

docker run -it -P 8080:80 ——name Web001 nginx

D.

docker pull -it -p 8080:80 —name Web00l nginx

Question 17

In which of the following filesystems are system logs commonly stored?

Options:

A.

/var

B.

/tmp

C.

/etc

D.

/opt

Question 18

A systems administrator was tasked with assigning the temporary IP address/netmask 192.168.168.1/255.255.255.255 to the interface eth0 of a Linux server.

When adding the address, the following error appears:

# ip address add 192.168.168.1/33 dev eth0

Error: any valid prefix is expected rather than "192.168.168.1/33".

Based on the command and its output above, which of the following is the cause of the issue?

Options:

A.

The CIDR value /33 should be /32 instead.

B.

There is no route to 192.168.168.1/33.

C.

The interface eth0 does not exist.

D.

The IP address 192.168.168.1 is already in use.

Question 19

The journald entries have filled a Linux machine’s /var volume. Which of the following is the best command for a systems administrator to use to free up the disk space occupied by these entries?

Options:

A.

journalctl --rotate

journalctl --vacuum-time=1s

B.

systemctl stop systemd-journald

systemctl start systemd-journald

C.

rm -rf /var/log/journal

systemctl restart systemd-journald

D.

pkill -HUP systemd-journald

systemctl restart systemd-journald

Question 20

The users of a Linux system are unable to use one of the application filesystems. The following outputs have been provided:

bash

$ cd /app

$ touch file

touch: cannot touch 'file': Readonly file system

Output 2

/dev/sdcl on /app type ext4 (ro,relatime,seclabel,data=ordered)

Output 3

/dev/sdcl /app ext4 defaults 0 0

Output 4

[302.048075] Buffer I/O error on dev sdcl, logical block 0, async page read

[302.048490] EXT4-fs (sdcl): Attempt to read block from filesystem resulted in short read while trying to re-open /dev/sdcl

Which of the following actions will resolve this issue?

Options:

A.

umount /app fsck -y /dev/sdcl mount /app

B.

xfs_repair /dev/sdcl mount -o rw,remount /app

C.

umount /app xfs_repair /dev/sdcl mount /app

D.

fsck -y /dev/sdcl mount -o rw,remount /app

Question 21

Users are reporting that a Linux server is responding slowly. A systems administrator troubleshooting the server issue sees the following iostat output, with %iowait at 50.38. Which of the following is most likely the issue?

Options:

A.

The CPU is mostly waiting for I/O operations.

B.

/ filesystem does not have enough storage allocated.

C.

/var filesystem is almost full.

D.

The CPU capacity is inadequate.

Question 22

A Linux systems administrator is configuring a new filesystem that needs the capability to be mounted persistently across reboots. Which of the following commands will accomplish this task? (Choose two.)

Options:

A.

df -h /data

B.

mkfs.ext4 /dev/sdc1

C.

fsck /dev/sdc1

D.

fdisk -l /dev/sdc1

E.

echo "/data /dev/sdc1 ext4 defaults 0 0" >> /etc/fstab

F.

echo "/dev/sdc1 /data ext4 defaults 0 0" >> /etc/fstab

Question 23

An administrator has source code and needs to rebuild a kernel module. Which of the following command sequences is most commonly used to rebuild this

type of module?

Options:

A.

./configure

make

make install

B.

wget

gcc

cp

C.

tar xvzf

build

cp

D.

build

install

configure

Question 24

Users have been unable to save documents to /home/tmp/temp and have been receiving the following error:

Path not found

A junior technician checks the locations and sees that /home/tmp/tempa was accidentally created instead of /home/tmp/temp. Which of the following commands should the technician use to fix this issue?

Options:

A.

cp /home/tmp/tempa /home/tmp/temp

B.

mv /home/tmp/tempa /home/tmp/temp

C.

cd /temp/tmp/tempa

D.

ls /home/tmp/tempa

Question 25

A Linux engineer set up two local DNS servers (10.10.10.10 and 10.10.10.20) and was testing email connectivity to the local mail server using the mail command on a local machine when the following error appeared:

The local machine DNS settings are:

Which of the following commands could the engineer use to query the DNS server to get mail server information?

Options:

A.

dig @example.com 10.10.10.20 a

B.

dig @10.10.10.20 example.com mx

C.

dig @example.com 10.10.10.20 ptr

D.

dig @10.10.10.20 example.com ns

Question 26

A Linux administrator is providing a new Nginx image from the registry to local cache. Which of the following commands would allow this to happen?

Options:

A.

docker pull nginx

B.

docker attach nginx

C.

docker commit nginx

D.

docker import nginx

Question 27

A Linux administrator is alerted to a storage capacity issue on a server without a specific mount point or directory. Which of the following commands would be MOST helpful for troubleshooting? (Choose two.)

Options:

A.

parted

B.

df

C.

mount

D.

du

E.

fdisk

F.

dd

G.

ls

Question 28

Which of the following should be used to verify the integrity of a file?

Options:

A.

sha256sum

B.

fsck

C.

gpg —d

D.

hashcat

Question 29

A database administrator requested the installation of a custom database on one of the servers. Which of the following should the Linux administrator configure so the requested packages can be installed?

Options:

A.

/etc/yum.conf

B.

/etc/ssh/sshd.conf

C.

/etc/yum.repos.d/db.repo

D.

/etc/resolv.conf

Question 30

A systems administrator is tasked with preventing logins from accounts other than root, while the file /etc/nologin exists. Which of the following PAM modules will accomplish this task?

Options:

A.

pam_login.so

B.

pam_access.so

C.

pam_logindef.so

D.

pam_nologin.so

Question 31

An administrator transferred a key for SSH authentication to a home directory on a remote server. The key file was moved to .ssh/authorized_keys location in order to establish SSH connection without a password. However, the SSH command still asked for the password. Given the following output:

Which of the following commands would resolve the issue?

Options:

A.

restorecon .ssh/authorized_keys

B.

ssh_keygen -t rsa -o .ssh/authorized_keys

C.

chown root:root .ssh/authorized_keys

D.

chmod 600 .ssh/authorized_keys

Question 32

Which of the following enables administrators to configure and enforce MFA on a Linux system?

Options:

A.

Kerberos

B.

SELinux

C.

PAM

D.

PKI

Question 33

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?

Options:

A.

The service does not have permissions to read write the startupfile.

B.

The service startupfile size cannot be 81k.

C.

The service startupfile cannot be owned by root.

D.

The service startupfile should not be owned by the root group.

Question 34

A Linux administrator is troubleshooting a memory-related issue. Based on the output of the commands:

Which of the following commands would address the issue?

Options:

A.

top -p 8321

B.

kill -9 8321

C.

renice -10 8321

D.

free 8321

Question 35

A Linux engineer needs to block an incoming connection from the IP address 2.2.2.2 to a secure shell server and ensure the originating IP address receives a response that a firewall is blocking the connection. Which of the following commands can be used to accomplish this task?

Options:

A.

iptables -A INPUT -p tcp -- dport ssh -s 2.2.2.2 -j DROP

B.

iptables -A INPUT -p tcp -- dport ssh -s 2.2.2.2 -j RETURN

C.

iptables -A INPUT -p tcp -- dport ssh -s 2.2.2.2 -j REJECT

D.

iptables -A INPUT -p tcp -- dport ssh -s 2.2.2.2 -j QUEUE

Question 36

Using AD Query, the security gateway connections to the Active Directory Domain Controllers using what protocol?

Options:

A.

Windows Management Instrumentation (WMI)

B.

Hypertext Transfer Protocol Secure (HTTPS)

C.

Lightweight Directory Access Protocol (LDAP)

D.

Remote Desktop Protocol (RDP)

Question 37

A Linux systems administrator needs to copy files and directories from Server A to Server B. Which of the following commands can be used for this purpose? (Select TWO)

Options:

A.

rsyslog

B.

cp

C.

rsync

D.

reposync

E.

scp

F.

ssh

Question 38

A Linux administrator needs to create a new cloud.cpio archive containing all the files from the current directory. Which of the following commands can help to accomplish this task?

Options:

A.

ls | cpio -iv > cloud.epio

B.

ls | cpio -iv < cloud.epio

C.

ls | cpio -ov > cloud.cpio

D.

ls cpio -ov < cloud.cpio

Question 39

A systems administrator is creating new user accounts on several Linux machines and wants to automate the process from a Linux system used for operations. In this operations system, the list of servers is located in the /home/user/serverslist file and the list of user accounts is located in the /home/user/userslist file. Which of the following scripts will help accomplish this task?

Options:

A.

bash

for server in $(cat /home/user/serverslist)

do

for user in $(cat /home/user/userslist)

do

sudo useradd $user

done

done

B.

bash

for server in $(cat /home/user/serverslist)

do

ssh -i user@$server "for user in $(cat /home/user/userslist)

do

sudo useradd $user

done; exit"

done

C.

bash

for server in $(cat /home/user/serverslist)

do

scp /home/user/userslist user@$server:/tmp

ssh -i user@$server "for user in $(cat /tmp/userslist)

do

sudo useradd $user

done; exit"

done

D.

bash

ssh user@$(cat /home/user/serverslist) "sudo useradd $(cat /home/user/userslist); exit"

Question 40

A user (userA) has reported issues while logging in to the system. The following output has been provided:

bash

Could not chdir to home directory /home/userA: Permission denied

-bash: /home/userA/.bash_profile: Permission denied

# cat /etc/passwd | grep userA

userA:x:1234:3400:userA account:/home/userA/:/bin/bash

# passwd -S userA

userA PS 2022-10-17 1 99999 0 (Password set. SHA512 crypt.)

# groups userA

admin dev usergrp

# ls -lth /home/

drwx------ 7 root admin 9 Jan 17 2019 userA

drwxr-xr-x 4 userC app 9 Jan 23 2020 userC

Which of the following describes the issue userA is having?

Options:

A.

The password for userA is not set

B.

The group for userA is not assigned correctly

C.

The account password for userA has expired

D.

The assigned home directory is not owned by userA

Question 41

Employees in the finance department are having trouble accessing the file /opt/work/file. All IT employees can read and write the file. Systems administrator reviews the following output:

Which of the following commands would permanently fix the access issue while limiting access to IT and finance department employees?

Options:

A.

chattr +i file

B.

chown it:finance file

C.

chmod 666 file

D.

setfacl -m g:finance:rw file

Question 42

Which of the following directories is the mount point in a UEFI system?

Options:

A.

/sys/efi

B.

/boot/efi

C.

/efi

D.

/etc/efi

Question 43

A user generated a pair of private-public keys on a workstation. Which of the following commands will allow the user to upload the public key to a remote server and enable passwordless login?

Options:

A.

scp ~/.ssh/id_rsa user@server:~/

B.

rsync ~ /.ssh/ user@server:~/

C.

ssh-add user server

D.

ssh-copy-id user@server

Question 44

A systems administrator needs to clone the partition /dev/sdc1 to /dev/sdd1. Which of the following commands will accomplish this task?

Options:

A.

tar -cvzf /dev/sdd1 /dev/sdc1

B.

rsync /dev/sdc1 /dev/sdd1

C.

dd if=/dev/sdc1 of=/dev/sdd1

D.

scp /dev/sdc1 /dev/sdd1

Question 45

A Linux administrator recently downloaded a software package that is currently in a compressed file. Which of the following commands will extract the files?

Options:

A.

unzip -v

B.

bzip2 -z

C.

gzip

D.

funzip

Question 46

An administrator created an initial Git repository and uploaded the first files. The administrator sees the following when listing the repository:

The administrator notices the file . DS STORE should not be included and deletes it from the online repository. Which of the following should the administrator run from the root of the local repository before the next commit to ensure the file is not uploaded again in future commits?

Options:

A.

rm -f .DS STORE && git push

B.

git fetch && git checkout .DS STORE

C.

rm -f .DS STORE && git rebase origin main

D.

echo .DS STORE >> .gitignore

Question 47

The development team created a new branch with code changes that a Linux administrator needs to pull from the remote repository. When the administrator looks for the branch in Git, the branch in question is not visible. Which of the following commands should the Linux administrator run to refresh the branch information?

Options:

A.

git fetch

B.

git checkout

C.

git clone

D.

git branch

Question 48

A Linux systems administrator needs to compress a file named passwords.txt. The compressed file should be saved as passwords.txt.gz. Which of the following commands should the administrator use to accomplish this task?

Options:

A.

gzip -c passwords.txt > passwords.txt.gz

B.

gzip -d passwords.txt | passwords.txt.gz

C.

gzip -n passwords.txt > passwords.txt.gz

D.

gzip -n passwords.txt < passwords.txt.gz

Question 49

A Linux administrator provisioned a new web server with custom administrative permissions for certain users. The administrator receives a report that user1 is unable to restart the Apache web service on this server. The administrator reviews the following output:

[ root@server ] # id user1

UID=1011 (user1) gid=1011 (USER1) groups=1011 (user1), 101 (www-data), 1120 (webadmin)

[ root@server ] # cat /etc/sudoers.d/custom.conf

user1 ALL=/usr/sbin/systemctl start httpd, /usr/sbin/systemctl stop httpd

webadmin ALL=NOPASSWD: /etc/init.d.httpd restart, /sbin/service httpd restart, /usr/sbin/apache2ctl restart

#%wheel ALL=(ALL) NOPASSWD: ALL

Which of the following would most likely resolve the issue while maintaining a least privilege security model?

Options:

A.

User1 should be added to the wheel group to manage the service.

B.

User1 should have "NOPASSWD:" after the "ALL=" in the custom. conf.

C.

The wheel line in the custom. conf file should be uncommented.

D.

Webadmin should be listed as a group in the custom. conf file.

Question 50

A systems administrator is receiving complaints about slow performance and system crashes. The administrator suspects memory and CPU issues. Which of the following is the first action the administrator should take to troubleshoot and resolve these issues?

Options:

A.

Run resource monitoring tools like top or htop to view the current CPU and memory use.

B.

Look through the system logs and error messages to find any faults involving the CPU and memory.

C.

Remove and replace the CPU and memory components to address hardware issues.

D.

Reboot the server to clear any CPU and memory congestion.

Question 51

Joe, a user, is unable to log in to the system. The Linux administrator checks the /etc/passwd file and reviews the following output:

Joe:x:1002:1002::/home/Joe:/sbin/nologin

Which of the following should the administrator do to fix this issue?

Options:

A.

Remove the x entry in the /etc/passwd file for Joe

B.

Change the /sbin/nologin entry to /bin/sh for Joe

C.

Issue the usermod -l Joe command

D.

Ensure that a corresponding entry is in the /etc/shadow file for Joe

Question 52

A Linux system is failing to boot. The following error is displayed in the serial console:

[[1;33mDEPEND[Om] Dependency failed for /data.

[[1;33mDEPEND[Om] Dependency failed for Local File Systems

...

Welcome to emergency mode! After logging in, type "journalctl -xb" to viewsystem logs, "systemct1 reboot" to reboot, "systemct1 default" to try again to boot into default mode.

Give root password for maintenance

(or type Control-D to continue}

Which of the following files will need to be modified for this server to be able to boot again?

Options:

A.

/etc/mtab

B.

/dev/sda

C.

/etc/fstab

D.

/ete/grub.conf

Question 53

A systems administrator receives the following errors via email from the system log:

go

XFS (loop0): Metadata CRC error detected at xfs_agi_read_verify+0xcb/0xfe

XFS (loop0): First 128 bytes of corrupted metadata buffer

XFS (loop0): metadata I/O error in "xfs_trans_read_buf_map" at daddr 0x2 len 1 error 74

A few minutes later, the administrator starts receiving reports that some of the images in the company's website are not loading properly. The systems administrator runs some commands and receives the following outputs:

css

Output 1

NAME FSTYPE UUID MOUNTPOINT

sda ext4 02ae47-fe457-45bc /

sdb xfs 347c7056 /var/www/html

Output 2

DocumentRoot "/var/www/html"

Output 3

httpd.service - The Apache HTTP Server

Loaded: loaded (/usr/lib/systemd/system/httpd.service; enabled; vendor preset: disabled)

Active: active (running) since Sun 1991-05-24 16:12:43 UTC; 30y ago

Main PID: 252 (httpd)

Which of the following would be the appropriate steps to take to solve this issue?

Options:

A.

systemctl stop httpd umount /dev/sdb1 xfs_repair /dev/sdb1 mount /dev/sdb1 /var/www/html systemctl start httpd

B.

umount /dev/sdb1 xfs_repair /dev/sdb1 xfs_metadump /dev/sdb1 mount /dev/sdb1 /var/www/html systemctl restart httpd

C.

umount /dev/sdb1 systemctl stop httpd xfs_metadump /dev/sdb1 mount /dev/sdb1 /var/www/html systemctl start httpd

D.

systemctl stop httpd xfs_check -L /dev/sdb umount /var/www/html systemctl start httpd

Question 54

The group owner of the / home/ test directory would like to preserve all group permissions on files created in the directory. Which of the following

commands should the group owner execute?

Options:

A.

chmod g+s /home/test

B.

chgrp test /home/test

C.

chmod 777 /home/test

D.

chown —hR test /home/test

Question 55

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?

Options:

A.

B.

C.

D.

Question 56

A systems administrator is cloning a system partition /dev/sda1 to /dev/sdc1. Which of the following commands would allow the administrator to accomplish this task most efficiently?

Options:

A.

dd if=/dev/sda1 of=/dev/sdc1

B.

cat /dev/sda1 > /dev/sdc1

C.

cp -R /dev/sda1 /dev/sdc1

D.

rsync -av /dev/sda1 /dev/sdc1

Question 57

A systems administrator received a notification that a system is performing slowly. When running the top command, the systems administrator can see the following values:

Which of the following commands will the administrator most likely run NEXT?

Options:

A.

vmstat

B.

strace

C.

htop

D.

lsof

Question 58

A junior Linux administrator is tasked with installing an application. The installation guide states the application should only be installed in a run level 5 environment.

Which of the following commands would ensure the server is set to runlevel 5?

Options:

A.

systemct1 isolate multi-user.target

B.

systemct1 isolate graphical.target

C.

systemct1 isolate network.target

D.

systemct1 isolate basic.target

Question 59

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?

Options:

A.

dmidecode -s system-version

B.

lscpu

C.

sysctl -a

D.

cat /sys/device/system/cpu/possible

Question 60

A Linux administrator found many containers in an exited state. Which of the following commands will allow the administrator to clean up the containers in an exited state?

Options:

A.

docker rm -- all

B.

docker rm $ (docker ps -aq)

C.

docker images prune *

D.

docker rm -- state exited

Question 61

A systems administrator requires that all files that are created by the user named web have read-only permissions by the owner. Which of the following commands will satisfy this requirement?

Options:

A.

chown web:web /home/web

B.

chmod -R 400 /home/web

C.

echo "umask 377" >> /home/web/.bashrc

D.

setfacl read /home/web

Question 62

A Linux administrator needs to redirect all HTTP traffic temporarily to the new proxy server 192.0.2.25 on port 3128. Which of the following commands will accomplish this task?

Options:

A.

iptables -t nat -D PREROUTING -p tcp --sport 80 -j DNAT - -to-destination 192.0.2.25:3128

B.

iptables -t nat -A PREROUTING -p top --dport 81 -j DNAT –-to-destination 192.0.2.25:3129

C.

iptables -t nat -I PREROUTING -p top --sport 80 -j DNAT –-to-destination 192.0.2.25:3129

D.

iptables -t nat -A PREROUTING -p tcp --dport 80 -j DNAT –-to-destination 192.0.2.25:3128

Question 63

A cloud engineer needs to launch a container named web-01 in background mode. Which of the following commands will accomplish this task''

Options:

A.

docker builder -f —name web-01 httpd

B.

docker load --name web-01 httpd

C.

docker ps -a --name web-01 httpd

D.

docker run -d --name web-01 httpd

Question 64

A Linux user reported the following error after trying to connect to the system remotely:

ssh: connect to host 10.0.1.10 port 22: Resource temporarily unavailable

The Linux systems administrator executed the following commands in the Linux system while trying to diagnose this issue:

Which of the following commands will resolve this issue?

Options:

A.

firewall-cmd --zone=public --permanent --add-service=22

B.

systemct1 enable firewalld; systemct1 restart firewalld

C.

firewall-cmd --zone=public --permanent --add-service=ssh

D.

firewall-cmd --zone=public --permanent --add-port=22/udp

Question 65

A Linux administrator is configuring a two-node cluster and needs to be able to connect the nodes to each other using SSH keys from the root account. Which of the following commands will accomplish this task?

Options:

A.

[root@nodea ssh —i ~/ . ssh/±d rsa root@nodeb

B.

[root@nodea scp -i . ssh/id rsa root@nodeb

C.

[root@nodea ssh—copy-id —i .ssh/id rsa root@nodeb

D.

[root@nodea # ssh add -c ~/ . ssh/id rsa root@nodeb

E.

[root@nodea # ssh add -c ~/. ssh/id rsa root@nodeb

Question 66

What is the main objective when using Application Control?

Options:

A.

To filter out specific content.

B.

To assist the firewall blade with handling traffic.

C.

To see what users are doing.

D.

Ensure security and privacy of information.

Question 67

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?

Options:

A.

Run git exclude app. conf.

B.

Run git stash app. conf.

C.

Add app . conf to . exclude.

D.

Add app . conf to . gitignore.

Question 68

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?

Options:

A.

telinit 0

B.

systemct1 reboot

C.

systemct1 get-default

D.

systemct1 emergency

Question 69

Based on an organization’s new cybersecurity policies, an administrator has been instructed to ensure that, by default, all new users and groups that are created fall within the specified values below.

To which of the following configuration files will the required changes need to be made?

Options:

A.

/etc/login.defs

B.

/etc/security/limits.conf

C.

/etc/default/useradd

D.

/etc/profile

Question 70

A Linux system is getting an error indicating the root filesystem is full. Which of the following commands should be used by the systems administrator to resolve this issue? (Choose three.)

Options:

A.

df -h /

B.

fdisk -1 /dev/sdb

C.

growpart /dev/mapper/rootvg-rootlv

D.

pvcreate /dev/sdb

E.

lvresize –L +10G -r /dev/mapper/rootvg-rootlv

F.

lsblk /dev/sda

G.

parted -l /dev/mapper/rootvg-rootlv

Question 71

A DevOps engineer pushed the updated configuration to an existing branch of a remote Git repository. Which of the following commands should the Linux administrator use to obtain these configuration changes?

Options:

A.

git pull

B.

git log

C.

git fetch

D.

git checkout main

Question 72

An administrator is provisioning an Apache web server. When the administrator visits the server website, the browser displays a message indicating the website cannot be reached. Which of the following commands should the administrator use to verify whether the service Is running?

Options:

A.

systemctlstatus httpd

B.

systemctlmask httpd

C.

systemctlreload httpd

D.

systemctlrestart httpd

Question 73

A DevOps engineer is working on a local copy of a Git repository. The engineer would like to switch from the main branch to the staging branch but notices the staging branch does not exist. Which of the following Git commands should the engineer use to perform this task?

Options:

A.

git branch —m staging

B.

git commit —m staging

C.

git status —b staging

D.

git checkout —b staging

Question 74

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?

Options:

A.

Isscsi

B.

fdisk

C.

blkid

D.

partprobe

Question 75

A cloud engineer is installing packages during VM provisioning. Which of the following should the engineer use to accomplish this task?

Options:

A.

Cloud-init

B.

Bash

C.

Docker

D.

Sidecar

Question 76

A systems administrator made some unapproved changes prior to leaving the company. The newly hired administrator has been tasked with revealing the system to a compliant state. Which of the following commands will list and remove the correspondent packages?

Options:

A.

dnf list and dnf remove last

B.

dnf remove and dnf check

C.

dnf info and dnf upgrade

D.

dnf history and dnf history undo last

Question 77

A Linux administrator is installing a web server and needs to check whether web traffic has already been allowed through the firewall. Which of the following commands should the administrator use to accomplish this task?

Options:

A.

firewalld query-service-http

B.

firewall-cmd --check-service http

C.

firewall-cmd --query-service http

D.

firewalld --check-service http

Question 78

A DevOps engineer needs to download a Git repository from Which of the following commands will achieve this goal?

Options:

A.

git clone https://git.company.com/admin/project.git

B.

git checkout https://git.company.com/admin/project.git

C.

git pull https://git.company.com/admin/project.git

D.

git branch https://git.company.com/admin/project.git

Question 79

A systems administrator needs to check if the service systemd-resolved.service is running without any errors. Which of the following commands will show this information?

Options:

A.

systemct1 status systemd-resolved.service

B.

systemct1 enable systemd-resolved.service

C.

systemct1 mask systemd-resolved.service

D.

systemct1 show systemd-resolved.service

Question 80

A Linux engineer wants to give read-write-execute permissions for the cloud_users directory to user Oliver. Which of the following commands should the engineer use?

Options:

A.

setfacl -L Oliver

/cloud_users

B.

setfacl -x rwx

/cloud_users

C.

setfacl -P rwx

/cloud_users

D.

setfacl -m u:Oliver

/cloud_users

Question 81

A senior Linux administrator has created several scripts that will be used to install common system applications. These scripts are published to a reposito-ry to share with the systems team. A junior Linux administrator needs to re-trieve the scripts and make them available on a local workstation. Which of the following Git commands should the junior Linux administrator use to accom-plish this task?

Options:

A.

fetch

B.

checkout

C.

clone

D.

branch

Question 82

A user is attempting to log in to a Linux server that has Kerberos SSO ena-bled. Which of the following commands should the user run to authenticate

and then show the ticket grants? (Select TWO).

Options:

A.

kinit

B.

klist

C.

kexec

D.

kioad

E.

pkexec

F.

realm

Question 83

A Linux administrator needs to analyze a failing application that is running inside a container. Which of the following commands allows the Linux administrator to enter the running container and analyze the logs that are stored inside?

Options:

A.

docker run -ti app /bin/sh

B.

podman exec -ti app /bin/sh

C.

podman run -d app /bin/bash

D.

docker exec -d app /bin/bash

Question 84

An administrator wants to execute a long-running script in the terminal while troubleshooting another issue. Which of the following options will achieve this goal?

Options:

A.

bash script.sh &

B.

source script.sh

C.

sh script.sh | jobs

D.

nice -10 ./script.sh

Question 85

Users are experiencing high latency when accessing a web application served by a Linux machine. A systems administrator checks the network interface counters and sees the following:

Which of the following is the most probable cause of the observed latency?

Options:

A.

The network interface is disconnected.

B.

A connection problem exists on the network interface.

C.

No IP address is assigned to the interface.

D.

The gateway is unreachable.

Question 86

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?

Options:

A.

B.

C.

D.

Question 87

A security team discovers that a web server has been running with elevated privileges and identifies it as a security violation. Which of the following items needs to be added to the webserver.service file to remediate the issue?

Options:

A.

In the [Service] section of the webserver.service file, add User=comptia.

B.

In the [Unit] section of the webserver.service file, add AllowIsolate=true.

C.

In the [Install] section of the webserver.service file, add WantedBy=single.target.

D.

Add After=network.target to the [Install] section of the webserver.service file.

Question 88

A systems administrator is tasked with configuring a repository on an RPM-based Linux system. Which of the following need to be reviewed and modified? (Select two).

Options:

A.

/etc/yum.conf

B.

/etc/apt/sources.list.d

C.

/etc/pam.d

D.

/etc/apt.conf

E.

/etc/yum.repos.d

F.

/etc/ssh/ssh_config

Question 89

As part of the requirements for installing a new application, the swappiness parameter needs to be changed to O. This change needs to persist across re-boots and be applied immediately. A Linux systems administrator is performing this change. Which of the following steps should the administrator complete to accomplish this task?

Options:

A.

echo "vm. swappiness—()" >> /etc/sysctl . conf && sysctl —p

B.

echo "vrn. >> / proc/meminfo && sysctl —a

C.

sysctl —v >> / proc/meminfo & & echo "vm. swapiness=0"

D.

sysctl —h "vm. swapiness—O" && echo / etc/vmswapiness

Question 90

Which of the following files holds the system configuration for journal when running systemd?

Options:

A.

/etc/systemd/journald.conf

B.

/etc/systemd/systemd-journalctl.conf

C.

/usr/lib/systemd/journalctl.conf

D.

/etc/systemd/systemd-journald.conf

Question 91

While troubleshooting server issues, a Linux systems administrator obtains the following output:

yaml

total used free shared buff/cache available

Mem: 3736 3538 33 2 48 25

Swap: 2047 1824 223

Which of the following best describes the state of the system?

Options:

A.

The system has consumed the system memory and swap space

B.

The system has enough free memory space

C.

The system has swap disabled

D.

The system has allocated enough buffer space

Question 92

A hardened physical Linux system allows regular, unprivileged users to remotely connect to the server using SSH only. No sudo tool has been installed. Which of the following should the Linux administrator use to perform administrative tasks on this host? (Select two).

Options:

A.

Create an SSH key and copy it to the remote server to allow passwordless login

B.

Access the server’s physical console and use the root user's password to log in

C.

Install the telnet server on this system to be able to use a root account

D.

Use the su command and enter the root user’s password

E.

Install the sudo command using the unprivileged user’s account

F.

Add the user to the wheel group

Question 93

An administrator is trying to diagnose a performance issue and is reviewing the following output:

System Properties:

CPU: 4 vCPU

Memory: 40GB

Disk maximum IOPS: 690

Disk maximum throughput: 44Mbps | 44000Kbps

Based on the above output, which of the following BEST describes the root cause?

Options:

A.

The system has reached its maximum IOPS, causing the system to be slow.

B.

The system has reached its maximum permitted throughput, therefore iowait is increasing.

C.

The system is mostly idle, therefore the iowait is high.

D.

The system has a partitioned disk, which causes the IOPS to be doubled.

Question 94

A systems administrator is notified that the mysqld process stopped unexpectedly. The systems administrator issues the following command:

sudo grep –i -r ‘out of memory’ /var/log

The output of the command shows the following:

kernel: Out of memory: Kill process 9112 (mysqld) score 511 or sacrifice child.

Which of the following commands should the systems administrator execute NEXT to troubleshoot this issue? (Select two).

Options:

A.

free -h

B.

nc -v 127.0.0.1 3306

C.

renice -15 $( pidof mysql )

D.

lsblk

E.

killall -15

F.

vmstat -a 1 4

Question 95

A Linux administrator needs to determine if prerequisites are met. One of the application requirements is to install Perl on a system. Which of the following commands would accomplish this task?

Options:

A.

rpm -Ufperl

B.

rpm -ivperl

C.

rpm -qaperl

D.

rpm -ehperl

Question 96

A systems administrator checked out the code from the repository, created a new branch, made changes to the code, and then updated the main branch. The systems administrator wants to ensure that the Terraform state files do not appear in the main branch. Which of following should the administrator use to meet this requirement?

Options:

A.

clone

B.

gitxgnore

C.

get

D.

.ssh

Question 97

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?

Options:

A.

find /var/log -type d -mtime +180 -print -exec rm {} \;

B.

find /var/log -type f -modified +180 -rm

C.

find /var/log -type f -mtime +180 -exec rm {} \

D.

find /var/log -type c -atime +180 –remove

Question 98

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?

Options:

A.

chmod u+x /home/user/script . sh

B.

chmod 600 /home/user/script . sh

C.

chmod /home/user/script . sh

D.

chmod 0+r /horne/user/script. sh

Question 99

A developer reported an incident involving the application configuration file /etc/httpd/conf/httpd.conf that is missing from the server. Which of the following identifies the RPM package that installed the configuration file?

Options:

A.

rpm -qf /etc/httpd/conf/httpd.conf

B.

rpm -ql /etc/httpd/conf/httpd.conf

C.

rpm —query /etc/httpd/conf/httpd.conf

D.

rpm -q /etc/httpd/conf/httpd.conf

Question 100

An administrator accidentally deleted the /boot/vmlinuz file and must resolve the issue before the server is rebooted. Which of the following commands should the administrator use to identify the correct

version of this file?

Options:

A.

rpm -qa | grep kernel; uname -a

B.

yum -y update; shutdown -r now

C.

cat /etc/centos-release; rpm -Uvh --nodeps

D.

telinit 1; restorecon -Rv /boot

Question 101

An administrator attempts to rename a file on a server but receives the following error.

The administrator then runs a few commands and obtains the following output:

Which of the following commands should the administrator run NEXT to allow the file to be renamed by any user?

Options:

A.

chgrp reet files

B.

chacl -R 644 files

C.

chown users files

D.

chmod -t files

Question 102

A cloud engineer needs to block the IP address 192.168.10.50 from accessing a Linux server. Which of the following commands will achieve this goal?

Options:

A.

iptables -F INPUT -j 192.168.10.50 -m DROP

B.

iptables -A INPUT -s 192.168.10.30 -j DROP

C.

iptables -i INPUT --ipv4 192.168.10.50 -z DROP

D.

iptables -j INPUT 192.168.10.50 -p DROP

Question 103

A Linux administrator updated the configuration file for the httpd web service. The administrator needs to apply the updated changes to the service without interrupting any running sessions. Which of the following commands should the administrator run to accomplish this task?

Options:

A.

systemctl reload httpd

B.

systemctl restart httpd

C.

systemctl status httpd

D.

systemctl mask httpd

Question 104

A Linux engineer needs to download a ZIP file and wants to set the nice of value to -10 for this new process. Which of the following commands will help to accomplish the task?

Options:

A.

$ nice -v -10 wget https://foo.com/installation.zip

B.

$ renice -v -10 wget https://foo.com/installation.2ip

C.

$ renice -10 wget https://foo.com/installation.zip

D.

$ nice -10 wget https://foo.com/installation.zip

Question 105

After connecting to a remote host via SSH, an administrator attempts to run an application but receives the following error:

arduino

Error: cannot open display:

Which of the following should the administrator do to resolve this error?

Options:

A.

Disconnect from the SSH session and reconnect using the ssh -X command

B.

Add Options X11 to the /home/admin/.ssh/authorized_keys file

C.

Open port 6000 on the workstation and restart the firewalld service

D.

Enable X11 forwarding in /etc/ssh/ssh_config and restart the server

Question 106

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

arduino

$ ls -ld /comptia

drwxr-x--- 2 root root 4096 Oct 20 20:13 /comptia

$ getfacl /comptia

# 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?

Options:

A.

Members of the wheel group can read files in /comptia.

B.

Newly created files in /comptia will have the sticky bit set.

C.

Other users can create files in /comptia.

D.

Only root can create files in /comptia.

Question 107

Which of the following will prevent non-root SSH access to a Linux server?

Options:

A.

Creating the /etc/nologin file

B.

Creating the /etc/nologin.allow file containing only a single line root

C.

Creating the /etc/nologin/login.deny file containing a single line +all

D.

Ensuring that /etc/pam.d/sshd includes account sufficient pam_nologin.so

Question 108

A Linux administrator is adding a new configuration file to a Git repository. Which of the following describes the correct order of Git commands to accomplish the task successfully?

Options:

A.

pull -> push -> add -> checkout

B.

pull -> add -> commit -> push

C.

checkout -> push -> add -> pull

D.

pull -> add -> push -> commit

Question 109

Users are reporting that a production application has slow performance. A systems administrator logs in to the server and performs some basic checks. Given the following:

yaml

[root@comptia]# ps -o pcpu; pidstat 1

Average: UID PID %usr %system %wait %CPU Command

Average: 0 937242 32.39 0 63.21 32.39 app_prd

Average: 0 937245 44.97 0.31 51.57 45.28 app_prd

Average: 0 937244 23.62 0 63.55 28.62 app_prd

[root@comptia]# vmstat 1

procs memory swap io system cpu

r b swpd free buff cache si so bi bo in cs us sy id wa st

16 0 978912 376320 50804 10296312 0 0 0 44 5503 2962 98 2 0 0 0

[root@comptia]# free -m

total used free shared buff/cache available

Mem: 15533 5063 365 164 10104 9975

Swap: 7931 955 6976

Which of the following is causing the performance issue?

Options:

A.

The server does not have enough memory

B.

Too many processes are running on the server

C.

The server CPU is receiving too much load

D.

The server is swapping

Question 110

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

Options:

A.

setenforce

B.

sudo

C.

umask

D.

chmod

Question 111

An administrator thinks that a package was installed using a snap. Which of the following commands can the administrator use to verify this information?

Options:

A.

snap list

B.

snap find

C.

snap install

D.

snap try

Question 112

A systems administrator wants to list all local account names and their respective UIDs. Which of the following commands will provide output containing this information?

Options:

A.

cut -c: -f3,1 /etc/passwd

B.

cut -d: -s2,3 /etc/passwd

C.

cut -d: -f1,3 /etc/passwd

D.

cut -n: -f1,2 /etc/passwd

Page: 1 / 38
Total 376 questions