XK0-005: CompTIA Linux+ Topic 2
Question #: 51
Topic #: 1
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
B. docker info
C. docker start
D. docker inspect
Selected Answer: D
Question #: 52
Topic #: 1
A Linux administrator is scheduling a system job that runs a script to check available disk space every hour. The Linux administrator does not want users to be able to start the job. Given the following:
The Linux administrator attempts to start the timer service but receives the following error message:
Which of the following is MOST likely the reason the timer will not start?
A. The checkdiskspace.timer unit should be enabled via systemctl.
B. The timers.target should be reloaded to get the new configuration.
C. The checkdiskspace.timer should be configured to allow manual starts.
D. The checkdiskspace.timer should be started using the sudo command.
Selected Answer: B
Question #: 53
Topic #: 1
A Linux administrator wants to find out whether files from the wget package have been altered since they were installed. Which of the following commands will provide the correct information?
A. rpm -i wget
B. rpm -qf wget
C. rpm -F wget
D. rpm -V wget
Selected Answer: D
Question #: 54
Topic #: 1
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?
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
Selected Answer: D
Question #: 55
Topic #: 1
A Linux engineer has been notified about the possible deletion of logs from the file /opt/app/logs. The engineer needs to ensure the log file can only be written into without removing previous entries.
Which of the following commands would be BEST to use to accomplish this task?
A. chattr +a /opt/app/logs
B. chattr +d /opt/app/logs
C. chattr +i /opt/app/logs
D. chattr +c /opt/app/logs
Selected Answer: A
Question #: 56
Topic #: 1
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?
A. systemctl status systemd-resolved.service
B. systemctl enable systemd-resolved.service
C. systemctl mask systemd-resolved.service
D. systemctl show systemd-resolved.service
Selected Answer: A
Question #: 58
Topic #: 1
A Linux administrator needs to remove software from the server. Which of the following RPM options should be used?
A. rpm -s
B. rрm -d
C. rpm -q
D. rpm -e
Selected Answer: D
Question #: 59
Topic #: 1
A Linux system fails to start and delivers the following error message:
Which of the following commands can be used to address this issue?
A. fsck.ext4 /dev/sda1
B. partprobe /dev/sda1
C. fdisk /dev/sda1
D. mkfs.ext4 /dev/sda1
Selected Answer: D
Question #: 60
Topic #: 1
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?
A. /etc/login.defs
B. /etc/security/limits.conf
C. /etc/default/useradd
D. /etc/profile
Selected Answer: A
Question #: 61
Topic #: 1
A Linux administrator is trying to remove the ACL from the file /home/user/data. txt but receives the following error message:
Given the following analysis:
Which of the following is causing the error message?
A. The administrator is not using a highly privileged account.
B. The filesystem is mounted with the wrong options.
C. SELinux file context is denying the ACL changes.
D. File attributes are preventing file modification.
Selected Answer: D
Question #: 62
Topic #: 1
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?
A. ls | cpio -iv > cloud.epio
B. ls | cpio -iv < cloud.epio
C. ls | cpio -ov > cloud.cpio
D. ls cpio -ov < cloud.cpio
Selected Answer: C
Question #: 63
Topic #: 1
A systems administrator made some changes in the ~/.bashrc file and added an alias command. When the administrator tried to use the alias command, it did not work. Which of the following should be executed FIRST?
A. source ~/.bashrc
B. read ~/.bashrc
C. touch ~/.bashrc
D. echo ~/.bashrc
Selected Answer: C
Question #: 64
Topic #: 1
A junior systems administrator has just generated public and private authentication keys for passwordless login. Which of the following files will be moved to the remote servers?
A. id_dsa.pem
B. id_rsa
C. id_ecdsa
D. id_rsa.pub
Selected Answer: B
Question #: 65
Topic #: 1
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
B. fsck -A
C. mount disk by-label
D. mount disk by-blkid
Selected Answer: C
Question #: 66
Topic #: 1
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
B. lscpu
C. sysctl -a
D. cat /sys/device/system/cpu/possible
Selected Answer: B
Question #: 67
Topic #: 1
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
B. chmod +rws /project/access2all
C. chmod 2770 /project/access2all
D. chmod ugo+rwx /project/access2all
Selected Answer: A
Question #: 68
Topic #: 1
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
B. sysctl -w net.ipv4.ip_forward=1
C. echo "net.ipv4.ip_forward=1" >> /etc/sysctl.conf
D. echo 1 > /proc/sys/net/ipv4/ip_forward
E. sysctl –p
F. echo “net.ipv6.conf.all.forwarding=l” >> /etc/sysctl.conf
Selected Answer: BC
Question #: 69
Topic #: 1
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 {} \;
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
Selected Answer: C
Question #: 70
Topic #: 1
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.
B.
C.
D.
Selected Answer: C
Question #: 71
Topic #: 1
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.
B.
C.
D.
Selected Answer: B
Question #: 72
Topic #: 1
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
B. mv .ssh/authorized_key .ssh/authorized_keys
C. systemctl restart sshd.service
D. chmod 600 mv .ssh/authorized_key
Selected Answer: B
Question #: 73
Topic #: 1
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.
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.
Selected Answer: A
Question #: 74
Topic #: 1
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
B. chown 1755 devops
C. chmod -s 755 devops
D. chmod 1755 devops
Selected Answer: D
Question #: 75
Topic #: 1
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.
B. The administrator did not set the default target to basic.target.
C. The administrator did not set the default target to graphical.target.
D. The administrator did not shut down the server properly.
Selected Answer: D
Question #: 76
Topic #: 1
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.
B. The server is running out of file descriptors.
C. Something is starving the server resources.
D. The amount of RAM allocated to the server is too high.
Selected Answer: C
Question #: 77
Topic #: 1
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
B. SETENV
C. $SHELL
D. $DISPLAY
Selected Answer: D
Question #: 78
Topic #: 1
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.
B. Create a unit file for the new service in /etc/systemd/system/ with the name helpme.service in the location.
C. Add #!//bin/bash to the top of the script.
D. Restart the computer to enable the new service.
E. Create a unit file for the new service in /etc/init.d with the name helpme.service in the location.
F. Shut down the computer to enable the new service.
Selected Answer: BC
Question #: 79
Topic #: 1
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
B. chmod 640 filename.log
C. chmod 740 filename.log
D. chmod 744 filename.log
Selected Answer: D
Question #: 80
Topic #: 1
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
B. passwd –s accountname
C. chmod -G system account name
D. chage -E -1 accountname
Selected Answer: D
Question #: 81
Topic #: 1
A systems administrator wants to be sure the sudo rules just added to /etc/sudoers are valid. Which of the following commands can be used for this task?
A. visudo -c
B. test -f /etc/sudoers
C. sudo vi check
D. cat /etc/sudoers | tee test
Selected Answer: A
Question #: 82
Topic #: 1
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?
A. scp ~/.ssh/id_rsa user@server:~/
B. rsync ~ /.ssh/ user@server:~/
C. ssh-add user server
D. ssh-copy-id user@server
Selected Answer: D
Question #: 83
Topic #: 1
A Linux administrator created a new file system. Which of the following files must be updated to ensure the filesystem mounts at boot time?
A. /etc/sysctl
B. /etc/filesystems
C. /etc/fstab
D. /etc/nfsmount.conf
Selected Answer: A
Question #: 84
Topic #: 1
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?
A. top -p 8321
B. kill -9 8321
C. renice -10 8321
D. free 8321
Selected Answer: B
Question #: 85
Topic #: 1
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?
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
Selected Answer: D
Question #: 86
Topic #: 1
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?
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
Selected Answer: A
Question #: 87
Topic #: 1
A cloud engineer needs to remove all dangling images and delete all the images that do not have an associated container. Which of the following commands will help to accomplish this task?
A. docker images prune -a
B. docker push images -a
C. docker rmi -a images
D. docker images rmi –all
Selected Answer: A
Question #: 88
Topic #: 1
A Linux system is failing to boot with the following error:
Which of the following actions will resolve this issue? (Choose two.)
A. Execute grub-install –root-directory=/mnt and reboot.
B. Execute grub-install /dev/sdX and reboot.
C. Interrupt the boot process in the GRUB menu and add rescue to the kernel line.
D. Fix the partition modifying /etc/default/grub and reboot.
E. Interrupt the boot process in the GRUB menu and add single to the kernel line.
F. Boot the system on a LiveCD/ISO.
Selected Answer: BF
Question #: 89
Topic #: 1
A Linux administrator needs to create an image named sda.img from the sda disk and store it in the /tmp directory. Which of the following commands should be used to accomplish this task?
A. dd of=/dev/sda if=/tmp/sda.img
B. dd if=/dev/sda of=/tmp/sda.img
C. dd –if=/dev/sda –of=/tmp/sda.img
D. dd –of=/dev/sda –if=/tmp/sda.img
Selected Answer: B
Question #: 90
Topic #: 1
A Linux administrator is creating a primary partition on the replacement hard drive for an application server. Which of the following commands should the administrator issue to verify the device name of this partition?
A. sudo fdisk /dev/sda
B. sudo fdisk -s /dev/sda
C. sudo fdisk -l
D. sudo fdisk -h
Selected Answer: C
Question #: 91
Topic #: 1
A systems administrator is investigating why one of the servers has stopped connecting to the internet.
Which of the following is causing the issue?
A. The DNS address has been commented out in the configuration file.
B. The search entry in the /etc/resolv.conf file is incorrect.
C. Wired connection 1 is offline.
D. No default route is defined.
Selected Answer: A
Question #: 92
Topic #: 1
A systems administrator is tasked with installing GRUB on the legacy MBR of the SATA hard drive. Which of the following commands will help the administrator accomplish this task?
A. grub-install /dev/hda
B. grub-install /dev/sda
C. grub-install /dev/sr0
D. grub-install /dev/hd0,0
Selected Answer: B
Question #: 93
Topic #: 1
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?
A. systemctl isolate multi-user.target
B. systemctl isolate graphical.target
C. systemctl isolate network.target
D. systemctl isolate basic.target
Selected Answer: A
Question #: 94
Topic #: 1
A Linux administrator is tasked with adding users to the system. However, the administrator wants to ensure the users’ access will be disabled once the project is over. The expiration date should be 2021-09-30. Which of the following commands will accomplish this task?
A. sudo useradd -e 2021-09-30 Project_user
B. sudo useradd -c 2021-09-30 Project_user
C. sudo modinfo -F 2021-09-30 Project_uses
D. sudo useradd -m -d 2021-09-30 Project_user
Selected Answer: A
Question #: 95
Topic #: 1
A DevOps engineer needs to download a Git repository from https://git.company.com/admin/project.git. Which of the following commands will achieve this goal?
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
Selected Answer: A
Question #: 96
Topic #: 1
An administrator installed an application from source into /opt/operations1/ and has received numerous reports that users are not able to access the application without having to use the full path /opt/operations1/bin/*. Which of the following commands should be used to resolve this issue?
A. echo ‘export PATH=$PATH:/opt/operations1/bin’ >> /etc/profile
B. echo ‘export PATH=/opt/operations1/bin’ >> /etc/profile
C. echo ‘export PATH=$PATH/opt/operations1/bin’ >> /etc/profile
D. echo ‘export $PATH:/opt/operations1/bin’ >> /etc/profile
Selected Answer: A
Question #: 97
Topic #: 1
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.)
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
H. vgextend /dev/rootvg /dev/sdb
Selected Answer: AEH
Question #: 98
Topic #: 1
A cloud engineer is asked to copy the file deployment.yaml from a container to the host where the container is running. Which of the following commands can accomplish this task?
A. docker cp container_id/deployment.yaml deployment.yaml
B. docker cp container_id:/deployment.yaml deployment.yaml
C. docker cp deployment.yaml local://deployment.yaml
D. docker cp container_id/deployment.yaml local://deployment.yaml
Selected Answer: B
Question #: 99
Topic #: 1
A Linux system is failing to start due to issues with several critical system processes. Which of the following options can be used to boot the system into the single user mode? (Choose two.)
A. Execute the following command from the GRUB rescue shell: mount -o remount, ro/sysroot.
B. Interrupt the boot process in the GRUB menu and add systemd.unit=single in the kernel line.
C. Interrupt the boot process in the GRUB menu and add systemd.unit=rescue.target in the kernel line.
D. Interrupt the boot process in the GRUB menu and add single=user in the kernel line.
E. Interrupt the boot process in the GRUB menu and add init=/bin/bash in the kernel line.
F. Interrupt the boot process in the GRUB menu and add systemd.unit=single.target in the kernel line.
Selected Answer: DE
Question #: 100
Topic #: 1
A DevOps engineer needs to allow incoming traffic to ports in the range of 4000 to 5000 on a Linux server. Which of the following commands will enforce this rule?
A. iptables -f filter -I INPUT -p tcp –dport 4000:5000 -A ACCEPT
B. iptables -t filter -A INPUT -p tcp –dport 4000:5000 -j ACCEPT
C. iptables filter -A INPUT -p tcp –dport 4000:5000 -D ACCEPT
D. iptables filter -S INPUT -p tcp –dport 4000:5000 -A ACCEPT
Selected Answer: B