ExamGecko
Home / CompTIA / XK0-005 / List of questions
Ask Question

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

List of questions

Question 251

Report
Export
Collapse

A technician just fixed a few issues in some code and is ready to deploy the code into production. Which of the following steps should the technician take next?

Create a new branch using git checkout.
Create a new branch using git checkout.
Perform a git clone to pull main down.
Perform a git clone to pull main down.
Create a git pull request to merge into main.
Create a git pull request to merge into main.
Perform a git pull to update the local copy of the code.
Perform a git pull to update the local copy of the code.
Suggested answer: C

Explanation:

After fixing issues in the code, the next step is to merge these changes into the main branch.This is typically done by creating a pull request78.

Reference: 7(https://zeet.co/blog/deploy-to-production) 8(https://stackoverflow.com/questions/11833511/git-deploy-to-production)

asked 02/10/2024
EDMARCIO S BRITO
26 questions

Question 252

Report
Export
Collapse

An administrator accidentally installed the httpd RPM package along with several dependencies. Which of the following options is the best way for the administrator to revert the package installation?

dnf clean all
dnf clean all
rpm -e httpd
rpm -e httpd
apt-get clean
apt-get clean
yum history undo last
yum history undo last
Suggested answer: D

Explanation:

The yum history undo last command will undo the last transaction, which in this case is the installation of the httpd RPM package and its dependencies. This will remove the packages that were installed and restore the previous state of the system. SeeHow to undo or redo yum transactionsandyum history. Reference 1: https://www.redhat.com/sysadmin/undo-redo-yum-transactions 2: https://man7.org/linux/man-pages/man8/yum.8.html#HISTORY


asked 02/10/2024
Vivek Nandey
34 questions

Question 253

Report
Export
Collapse

A Linux administrator generated a list of users who have root-level command-line access to the Linux server to meet an audit requirement. The administrator analyzes the following /etc/passwd and /etc/sudoers files:

$ cat /etc/passwd

root:x: 0:0: :/home/root: /bin/bash

lee: x: 500: 500: :/home/lee:/bin/tcsh

mallory:x: 501:501: :/root:/bin/bash

eve:x: 502: 502: /home/eve:/bin/nologin

carl:x:0:503: :/home/carl:/bin/sh

bob:x: 504: 504: : /home/bob:/bin/ksh

alice:x: 505:505: :/home/alice:/bin/rsh

$ cat /etc/sudoers

Cmnd_Alias SHELLS = /bin/tcsh, /bin/sh, /bin/bash

Cmnd_Alias SYSADMIN = /usr/sbin/tcpdump

ALL = (ALL) ALL

ALL = NOPASSWD: SYSADMIN

Which of the following users, in addition to the root user, should be listed in the audit report as having root-level command-line access? (Select two).

Carl
Carl
Lee
Lee
Mallory
Mallory
Eve
Eve
Bob
Bob
Alice
Alice
Suggested answer: A, C

Explanation:

The users who have root-level command-line access are those who have either the same user ID (UID) as root, which is 0, or the ability to run commands as root using sudo. Based on the /etc/passwd and /etc/sudoers files, the users who meet these criteria are:

Carl: Carl has the same UID as root, which is 0, as shown in the /etc/passwd file. This means that Carl can log in as root and execute any command with root privileges1

Mallory: Mallory has the ability to run commands as root using sudo, as shown in the /etc/sudoers file. The line ALL = (ALL) ALL means that any user can run any command as any other user, including root, by using sudo. Mallory can also use the root shell /bin/bash as her login shell, as shown in the /etc/passwd file2

Therefore, the correct answer is A and C. Lee, Eve, Bob, and Alice do not have root-level command-line access because they have different UIDs from root and they cannot use sudo to run commands as root. Lee can only use sudo to run the commands listed in the Cmnd_Alias SHELLS, which are /bin/tcsh, /bin/sh, and /bin/bash. Eve cannot log in at all because her login shell is /bin/nologin. Bob and Alice can only use sudo to run the command /usr/sbin/tcpdump without a password, as specified by the Cmnd_Alias SYSADMIN and the line ALL = NOPASSWD: SYSADMIN2

asked 02/10/2024
Nicos Chamberlain
34 questions

Question 254

Report
Export
Collapse

A systems administrator is configuring a Linux system so the network traffic from the internal network 172.17.0.0/16 going out through the eth0 interface would appear as if it was sent directly from this interface. Which of the following commands will accomplish this task?

iptables -A POSTROUTING -s 172.17.0.0/16 -o eth0 -j MASQUERADE
iptables -A POSTROUTING -s 172.17.0.0/16 -o eth0 -j MASQUERADE
firewalld -A OUTPUT -s 172.17.0.0/16 -o eth0 -j DIRECT
firewalld -A OUTPUT -s 172.17.0.0/16 -o eth0 -j DIRECT
nmcli masq-traffic eth0 -s 172.17.0.0/16 -j MASQUERADE
nmcli masq-traffic eth0 -s 172.17.0.0/16 -j MASQUERADE
ifconfig -- nat eth0 -s 172.17.0.0/16 -j DIRECT
ifconfig -- nat eth0 -s 172.17.0.0/16 -j DIRECT
Suggested answer: A

Explanation:

This command will use the iptables tool to append a rule to the POSTROUTING chain of the nat table, which will match any packet with a source address of 172.17.0.0/16 and an output interface of eth0, and apply the MASQUERADE target to it.This means that the packet will have its source address changed to the address of the eth0 interface, effectively hiding the internal network behind a NAT12.

asked 02/10/2024
Shan Panikker
28 questions

Question 255

Report
Export
Collapse

A user is unable to log on to a Linux workstation. The systems administrator executes the following command:

cat /etc/shadow | grep user1

The command results in the following output:

user1 :! $6$QERgAsdvojadv4asdvaarC/9dj34GdafGVaregmkdsfa:18875:0:99999:7 :::

Which of the following should the systems administrator execute to fix the issue?

chown -R userl:user1 /home/user1
chown -R userl:user1 /home/user1
sed -i '/ ::: / :: /g' /etc/shadow
sed -i '/ ::: / :: /g' /etc/shadow
chgrp user1:user1 /home/user1
chgrp user1:user1 /home/user1
passwd -u user1
passwd -u user1
Suggested answer: D

Explanation:

The output shows that the user1 account has a locked password, indicated by the exclamation point (!) in the second field of the /etc/shadow file1.To unlock the password and allow the user to log in, the systems administrator should use the passwd command with the -u (unlock) option2.

asked 02/10/2024
Cornelia Bauer
35 questions

Question 256

Report
Export
Collapse

A Linux engineer finds multiple failed login entries in the security log file for application users. The Linux engineer performs a security audit and discovers a security issue. Given the following:

# grep -iE '*www*|db' /etc/passwd

www-data:x:502:502:www-data:/var/www:/bin/bash

db:x: 505:505:db: /opt/db:/bin/bash

Which of the following commands would resolve the security issue?

usermod -d /srv/www-data www-data && usermod -d /var/lib/db db
usermod -d /srv/www-data www-data && usermod -d /var/lib/db db
passwd -u www-data && passwd -u db
passwd -u www-data && passwd -u db
renice -n 1002 -u 502 && renice -n 1005 -u 505
renice -n 1002 -u 502 && renice -n 1005 -u 505
chsh -s /bin/false www-data && chsh -s /bin/false db
chsh -s /bin/false www-data && chsh -s /bin/false db
Suggested answer: D

Explanation:

This command will use the chsh tool to change the login shell of the users www-data and db to /bin/false, which means they will not be able to log in to the system1. This will prevent unauthorized access attempts and improve security.

asked 02/10/2024
Ivan Mazala
43 questions

Question 257

Report
Export
Collapse

A Linux administrator has defined a systemd script docker-repository.mount to mount a volume for use by the Docker service. The administrator wants to ensure that Docker service does not start until the volume is mounted. Which of the following configurations needs to be added to the Docker service definition to best accomplish this task?

After=docker-respository.mount
After=docker-respository.mount
ExecStart=/usr/bin/mount -a
ExecStart=/usr/bin/mount -a
Requires=docker-repository.mount
Requires=docker-repository.mount
RequiresMountsFor=docker-repository.mount
RequiresMountsFor=docker-repository.mount
Suggested answer: C

Explanation:

This option declares an explicit dependency between the Docker service and the docker-repository.mount unit. It means that the Docker service will not start unless the docker-repository.mount unit is successfully activated.This ensures that the volume is mounted before the Docker service tries to use it12.

asked 02/10/2024
Christian Galea
40 questions

Question 258

Report
Export
Collapse

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

Creating the /etc/nologin file
Creating the /etc/nologin file
Creating the /etc/nologin.allow file containing only a single line root
Creating the /etc/nologin.allow file containing only a single line root
Creating the /etc/nologin/login.deny file containing a single line +all
Creating the /etc/nologin/login.deny file containing a single line +all
Ensuring that /etc/pam.d/sshd includes account sufficient pam_nologin.so
Ensuring that /etc/pam.d/sshd includes account sufficient pam_nologin.so
Suggested answer: A

Explanation:

This file prevents any non-root user from logging in to the system, regardless of the authentication method. The contents of the file are displayed to the user before the login is terminated.This can be useful for system maintenance or security reasons12.

asked 02/10/2024
Grant Taylor
58 questions

Question 259

Report
Export
Collapse

A systems administrator is working on a security report from the Linux servers. Which of the following commands can the administrator use to display all the firewall rules applied to the Linux servers? (Select two).

ufw limit
ufw limit
iptables ---F
iptables ---F
systemct1 status firewalld
systemct1 status firewalld
firewall---cmd ------1ist---a11
firewall---cmd ------1ist---a11
ufw status
ufw status
iptables ---A
iptables ---A
Suggested answer: D, E

Explanation:

These commands can display all the firewall rules applied to the Linux servers, depending on which firewall service is being used.

The firewall-cmd command is a utility for managing firewalld, which is a dynamic firewall service that supports zones and services. The --list-all option will show all the settings and rules for the default zone, or for a specific zone if specified.For example, firewall-cmd --list-all --zone=public will show the rules for the public zone1.

The ufw command is a frontend for iptables, which is a low-level tool for manipulating netfilter, the Linux kernel's packet filtering framework. The status option will show the status of ufw and the active rules, or the numbered rules if verbose is specified.For example, ufw status verbose will show the numbered rules and other information2.

The other options are incorrect because:

A) ufw limit

This command will limit the connection attempts to a service or port using iptables' recent module.It does not display any firewall rules2.

B) iptables -F

This command will flush (delete) all the rules in the selected chain, or all chains if none is given.It does not display any firewall rules3.

C) systemctl status firewalld

This command will show the status of the firewalld service, including whether it is active or not, but it does not show the firewall rules4.

F) iptables -A

This command will append one or more rules to the end of the selected chain.It does not display any firewall rules3.

asked 02/10/2024
Miguel Monteiro
38 questions

Question 260

Report
Export
Collapse

An administrator needs to make an application change via a script that must be run only in console mode. Which of the following best represents the sequence the administrator should execute to accomplish this task?

systemct1 isolate multi-user.target sh script.sh systemct1 isolate graphical.target
systemct1 isolate multi-user.target sh script.sh systemct1 isolate graphical.target
systemct1 isolate graphical.target sh script.sh systemct1 isolate multi-user.target
systemct1 isolate graphical.target sh script.sh systemct1 isolate multi-user.target
sh script.sh systemct1 isolate multi-user.target systemct1 isolate graphical.target
sh script.sh systemct1 isolate multi-user.target systemct1 isolate graphical.target
systemct1 isolate multi-user.target systemct1 isolate graphical.target sh script.sh
systemct1 isolate multi-user.target systemct1 isolate graphical.target sh script.sh
Suggested answer: A

Explanation:

The correct answer is A. systemctl isolate multi-user.target sh script.sh systemctl isolate graphical.target

This sequence will allow the administrator to switch from the graphical mode to the console mode, run the script, and then switch back to the graphical mode.

The systemctl command is used to control the systemd system and service manager, which manages the boot targets and services on Linux systems. The isolate subcommand starts the unit specified on the command line and its dependencies and stops all others. The multi-user.target is a boot target that provides a text-based console login, while the graphical.target is a boot target that provides a graphical user interface. By using systemctl isolate, the administrator can change the boot target on the fly without rebooting the system.

The sh command is used to run a shell script, which is a file that contains a series of commands that can be executed by the shell. The script.sh is the name of the script that contains the application change that the administrator needs to make. By running sh script.sh, the administrator can execute the script in the console mode.

The other options are incorrect because:

B) systemctl isolate graphical.target sh script.sh systemctl isolate multi-user.target

This sequence will switch from the console mode to the graphical mode, run the script, and then switch back to the console mode. This is not what the administrator wants to do, as the script must be run only in console mode.

C) sh script.sh systemctl isolate multi-user.target systemctl isolate graphical.target

This sequence will run the script in the current mode, which may or may not be console mode, and then switch to console mode and back to graphical mode. This is not what the administrator wants to do, as the script must be run only in console mode.

D) systemctl isolate multi-user.target systemctl isolate graphical.target sh script.sh

This sequence will switch from graphical mode to console mode and then back to graphical mode, without running the script at all. This is not what the administrator wants to do, as the script must be run only in console mode.

systemctl(1) - Linux manual page

How to switch between the CLI and GUI on a Linux server

How to PROPERLY boot into single user mode in RHEL/CentOS 7/8

Changing Systemd Boot Target in Linux

Exit Desktop to Terminal in Ubuntu 19.10

asked 02/10/2024
Russell Ang
34 questions
Total 397 questions
Go to page: of 40
Search

Related questions