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?
-
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
Reveal answer details
Close answer details
Correct answerD
ExplanationThe command iptables -t nat -A PREROUTING -p tcp --dport 80 -j DNAT -- to-destination 192.0.2.25:3128 adds a rule to the nat table that redirects all incoming TCP packets with destination port 80 (HTTP) to the proxy server 192.0.2.25 on port 3128. This is the correct way to achieve the task. The other options are incorrect because they either delete a rule (-D), use the wrong protocol (top instead of tcp), or use the wrong port (81 instead of 80). References: CompTIA Linux+ (XK0-005) Certification Study Guide, Chapter 12: Managing Network Connections, page 381.
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?
-
A
-
B
-
C
-
D
chown --hR test /home/test
Reveal answer details
Close answer details
Correct answerA
ExplanationThe correct answer is A. chmod g+s /home/test This command will set the setgid bit on the /home/test directory, which means that any file or subdirectory created in the directory will inherit the group ownership of the directory. This way, the group permissions on files created in the directory will be preserved. The chmod command is used to change the permissions of files and directories. The g+s option is used to set the setgid bit for the group. The other options are incorrect because: B. chgrp test /home/test This command will change the group ownership of the /home/test directory to test, but it will not affect the group ownership of files created in the directory. The chgrp command is used to change the group of files and directories. The test / home/test arguments are used to specify the new group and the target directory. C. chmod 777 /home/test This command will give read, write, and execute permissions to everyone (owner, group, and others) on the /home/test directory, but it will not affect the group ownership or permissions of files created in the directory. The chmod command is used to change the permissions of files and directories. The 777 argument is an octal number that represents the permissions in binary form. D. chown -hR test /home/test This command will change the owner and group of the /home/test directory and all its contents recursively to test, but it will not preserve the original group permissions on files created in the directory. The chown command is used to change the owner and group of files and directories. The -hR option is used to affect symbolic links and operate on all files and directories recursively. The test /home/test arguments are used to specify the new owner and group and the target directory. References: How to Set File Permissions Using chmod How to Use Chmod Command in Linux with Examples How to Use Chown Command in Linux with Examples [How to Use Chgrp Command in Linux with Examples]
A systems administrator wants to leverage their password-protected SSH key to connect to multiple servers without entering their password every time. Which of the following commands should the administrator use?
-
A
-
B
-
C
-
D
Reveal answer details
Close answer details
A new hard drive /dev/sdd was added to a server. Which of the following commands will create a partition table with a single partition /dev/sdd1 that consumes the entire disk?
-
A
echo 'type=83' | sudo sfdisk /dev/sdd
-
B
sudo sfdisk /dev/sdd -t=83
-
C
echo 'auto' | sudo fdisk /dev/sdd
-
D
sudo fdisk /dev/sdd -1 -t=83
Reveal answer details
Close answer details
Correct answerA
ExplanationThe sfdisk tool is used to manipulate partition tables in Linux. Option A creates a single partition on /dev/ sdd of type 83 (Linux filesystem).
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
-
B
-
C
-
D
Reveal answer details
Close answer details
Correct answerB
ExplanationThe command that would address the memory-related issue is kill -9 8321. This command will send a SIGKILL signal to the process with the PID 8321, which is the mysqld process that is using 99.7% of the available memory according to the top output. The SIGKILL signal will terminate the process immediately and free up the memory it was using. However, this command should be used with caution as it may cause data loss or corruption if the process was performing some critical operations. The other options are not correct commands for addressing the memory-related issue. The top -p 8321 command will only display information about the process with the PID 8321, but will not kill it or reduce its memory usage. The renice -10 8321 command will change the priority (niceness) of the process with the PID 8321 to -10, which means it will have a higher scheduling priority, but this will not affect its memory consumption. The free 8321 command is invalid because free does not take a PID as an argument; free only displays information about the total, used, and free memory in the system. References: How to troubleshoot Linux server memory issues kill(1) - Linux manual page
A systems administrator has been tasked with disabling the nginx service from the environment to prevent it from being automatically and manually started. Which of the following commands will accomplish this task?
-
A
-
B
-
C
-
D
Reveal answer details
Close answer details
Correct answerC
ExplanationThe command systemct1 mask nginx disables the nginx service from the environment and prevents it from being automatically and manually started. This command creates a symbolic link from the service unit file to /dev/null, which makes the service impossible to start. This is the correct way to accomplish the task. The other options are incorrect because they either do not exist (systemct1 cancel nginx), do not prevent manual start (systemct1 disable nginx), or do not prevent automatic start (systemct1 stop nginx). References: CompTIA Linux+ (XK0-005) Certification Study Guide, Chapter 14: Managing Processes and Scheduling Tasks, page 429.
A Linux administrator needs to create a new user named user02. However, user02 must be in a different home directory, which is under /comptia/projects. Which of the following commands will accomplish this task?
-
A
useradd -d /comptia/projects user02
-
B
useradd -m /comptia/projects user02
-
C
useradd -b /comptia/projects user02
-
D
useradd -s /comptia/projects user02
Reveal answer details
Close answer details
Correct answerA
ExplanationThe command useradd -d /comptia/projects user02 will accomplish the task of creating a new user named user02 with a different home directory. The useradd command is a tool for creating new user accounts on Linux systems. The - d option specifies the home directory for the new user, which is the directory where the user's personal files and settings are stored. The /comptia/projects is the path of the home directory for the new user, which is different from the default location of /home/user 02. The user02 is the name of the new user. The command useradd -d /comptia/projects user02 will create a new user named user02 with a home directory under /comptia/projects. This is the correct command to use to accomplish the task. The other options are incorrect because they either do not specify the home directory for the new user (useradd -m /comptia/projects user02 or useradd -s /comptia/projects user02) or do not use the correct option for the home directory (useradd -b /comptia/projects user02 instead of useradd -d /comptia/projects user02). References: CompTIA Linux+ (XK0-005) Certification Study Guide, Chapter 13: Managing Users and Groups, page 403.
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?
-
A
-
B
-
C
-
D
Reveal answer details
Close answer details
Correct answerB
ExplanationThe best tool to use when uploading the public key to the remote servers is B. ssh-copy-id. This tool will copy the public key from the local computer to the remote server and append it to the authorized_keys file, which is used for public key authentication. This tool will also create the necessary directories and files on the remote server if they do not exist. The other tools are either not suitable or not relevant for this task. For example: A. scp is a tool for securely copying files between hosts, but it does not automatically add the public key to the authorized_keys file. C. ssh-agent is a tool for managing private keys and passphrases, but it does not upload the public key to the remote server. D. ssh-keyscan is a tool for collecting public keys from remote hosts, but it does not upload the public key to the remote server.
A Linux administrator copied a Git repository locally, created a feature branch, and committed some changes to the feature branch. Which of the following Git actions should the Linux administrator use to publish the changes to the main branch of the remote repository?
-
A
-
B
-
C
-
D
Reveal answer details
Close answer details
Correct answerD
ExplanationThe push action is used to publish the changes made in a local branch to a remote branch of a Git repository. This action will update the remote branch with the commits made in the local branch and synchronize the two branches. The rebase action is used to reapply commits from one branch onto another branch, creating a linear history of commits. This action does not publish any changes to a remote repository. The tag action is used to create an annotated reference to a specific commit in a Git repository. This action does not publish any changes to a remote repository. The commit action is used to record changes made in the local repository and create a new snapshot of the project state. This action does not publish any changes to a remote repository. References: CompTIA Linux+ (XK0-005) Certification Study Guide, Chapter 20: Writing and Executing Bash Shell Scripts, page 579.
Question 10
Single choice
An administrator recently updated the BIND software package and would like to review the default configuration that shipped with this version. Which of the following files should the administrator review?
-
A
-
B
-
C
-
D
Reveal answer details
Close answer details
Correct answerA
ExplanationAfter installing a new version of a package that includes a configuration file that already exists on the system, such as /etc/httpd/conf/httpd.conf, RPM will create a new file with the .rpmnew extension instead of overwriting the existing file. This allows the administrator to review the default configuration that shipped with this version and compare it with the current configuration before deciding whether to merge or replace the files. The /etc/named.conf.rpmsave file is created by RPM when a package is uninstalled and it contains a configuration file that was modified by the administrator. This allows the administrator to restore the configuration file if needed. The /etc/named.conf file is the main configuration file for the BIND name server, not the httpd web server. The /etc/bind/bind.conf file does not exist by default in Linux systems. References: CompTIA Linux+ (XK0-005) Certification Study Guide, Chapter 19: Managing Packages and Software, page 561.
Question 11
Single choice
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?
-
A
firewalld query-service-http
-
B
firewall-cmd --check-service http
-
C
firewall-cmd --query-service http
-
D
firewalld --check-service http
Reveal answer details
Close answer details
Correct answerC
ExplanationThe command firewall-cmd --query-service http will accomplish the task of checking whether web traffic has already been allowed through the firewall. The firewall-cmd command is a tool for managing firewalld, which is a firewall service that provides dynamic and persistent network security on Linux systems. The firewalld uses zones and services to define the rules and policies for the network traffic. The zones are logical groups of network interfaces and sources that have the same level of trust and security. The services are predefined sets of ports and protocols that are associated with certain applications or functions. The --query-service http option queries whether a service is enabled in a zone. The http is the name of the service that the command should check. The http service represents the web traffic that uses the port 80 and the TCP protocol. The command firewall-cmd --query-service http will check whether the http service is enabled in the default zone, which is usually the public zone. The command will return yes if the web traffic has already been allowed through the firewall, or no if the web traffic has not been allowed through the firewall. This is the correct command to use to accomplish the task. The other options are incorrect because they either do not exist (firewalld query-service-http or firewalld --check-service http) or do not query the service (firewall-cmd --check-service http instead of firewall-cmd --query-service http). References: CompTIA Linux+ (XK0-005) Certification Study Guide, Chapter 12: Managing Network Connections, page 392.
Question 12
Single choice
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?
-
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
Reveal answer details
Close answer details
Correct answerC
ExplanationThe /etc/passwd file contains user account information, where each line includes fields separated by colons. To list all user accounts and their UIDs, use cut -d: -f1,3 /etc/passwd. This cuts the first field (username) and the third field (UID) from each line.
Question 13
Single choice
A systems administrator is tasked with creating an Ansible playbook to automate the installation of patches on several Linux systems. In which of the following languages should the playbook be written?
-
A
-
B
-
C
-
D
Reveal answer details
Close answer details
Correct answerB
ExplanationThe language that the playbook should be written in is YAML. YAML stands for YAML Ain't Markup Language, which is a human-readable data serialization language. YAML is commonly used for configuration files and data exchange. YAML uses indentation, colons, dashes, and brackets to represent the structure and values of the data. YAML also supports comments, variables, expressions, and functions. Ansible is an open-source tool for automating tasks and managing configuration on Linux systems. Ansible uses YAML to write playbooks, which are files that define the desired state and actions for the systems. Playbooks can be used to automate the installation of patches on several Linux systems by specifying the hosts, tasks, modules, and parameters. The language that the playbook should be written in is YAML. This is the correct answer to the question. The other options are incorrect because they are not the languages that Ansible uses for playbooks (SQL, HTML, or JSON). References: CompTIA Linux+ (XK0-005) Certification Study Guide, Chapter 18: Securing Linux Systems, page 549.
Question 14
Single choice
A Linux administrator is configuring Apache on a system and needs to allow the service to start after every startup. Which of the following commands will allow the Linux administrator to accomplish this task while starting the service at the same time?
-
A
systemctl mask --state=active httpd
-
B
systemctl start --runtime boot httpd
-
C
systemctl set-property restart httpd
-
D
systemctl enable --now httpd
Reveal answer details
Close answer details
Question 15
Multiple choice
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).
-
A
-
B
-
C
-
D
-
E
-
F
Reveal answer details
Close answer details
Correct answersA, C
ExplanationThe 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
Question 16
Single choice
A systems administrator receives reports that several virtual machines in a host are responding slower than expected. Upon further investigation, the administrator obtains the following output from one of the affected systems:  Which of the following best explains the reported issue?
-
A
The physical host is running out of CPU resources, leading to insufficient CPU time being allocated to virtual machines.
-
B
The physical host has enough CPU cores, leading to users running more processes to compensate for the slower response times.
-
C
The virtual machine has enough CPU cycles, leading to the system use percentage being higher than expected.
-
D
The virtual machine is running out of CPU resources, leading to users experiencing longer response times.
Reveal answer details
Close answer details
Correct answerD
ExplanationBased on the output from one of the affected systems, the best explanation for the reported issue is that the virtual machine is running out of CPU resources, leading to users experiencing longer response times (D). The output shows that the system use percentage is very high (57.85%), indicating that the virtual machine is using most of its CPU cycles for system processes. This leaves little CPU time for user processes, which results in slower performance. The other explanations are not supported by the output or are contradictory. References: [CompTIA Linux+ Study Guide], Chapter 8: Optimizing Linux Performance, Section: Monitoring CPU Usage [How to Interpret CPU Usage Statistics]
Question 17
Single choice
A Linux administrator discovers that a configured schedule is not running properly and needs to re-create the schedule. The task should run every Monday at 13:30 but only during the months of February, May, August, and November. Which of the following options should the administrator use?
-
A
OnCalendar=Mon *-2,5,8,11 13:30:00
-
B
OnCalendar=Mon *-Feb,*-May,*-Aug,*-Nov 13:30:00
-
C
OnCalendar=*-2,5,8,11 Mon 13:30:00
-
D
OnCalendar=Mon *-Feb *-May *-Aug *-Nov 13:30:00
Reveal answer details
Close answer details
Question 18
Single choice
Following the migration from a disaster recovery site, a systems administrator wants a server to require a user to change credentials at initial login. Which of the following commands should be used to ensure the aging attribute?
-
A
-
B
-
C
-
D
Reveal answer details
Close answer details
Correct answerB
ExplanationThe chage command can be used to change the user password expiry information. The -d or --lastday option sets the last password change date. If the value is 0, the user will be forced to change the password at the next login. See chage command in Linux with examples and 10 chage command examples in Linux.
Question 19
Single choice
A systems administrator is tasked with setting up key-based SSH authentication. In which of the following locations should the administrator place the public keys for the server?
-
A
-
B
-
C
-
D
Reveal answer details
Close answer details
Correct answerC
ExplanationThe administrator should place the public keys for the server in the ~/.ssh/authorized_keys file. The SSH (Secure Shell) protocol is a method for establishing secure and encrypted connections between remote systems. The SSH protocol supports two types of authentication: password-based and key-based. Password-based authentication requires the user to enter the password of the remote system every time they connect. Key-based authentication requires the user to generate a pair of cryptographic keys: a public key and a private key. The public key is stored on the remote system, while the private key is kept on the local system. The public key and the private key are mathematically related, but not identical. The SSH protocol uses the keys to verify the identity of the user and establish a secure connection without requiring a password. The ~/.ssh/authorized_keys file is a file that contains the public keys of the users who are allowed to connect to the remote system using key-based authentication. The administrator should place the public keys for the server in this file, one per line, and set the appropriate permissions for the file. The administrator should also configure the SSH server to enable key-based authentication by editing the /etc/ ssh/sshd_config file and setting the option PasswordAuthentication to no. The administrator should place the public keys for the server in the ~/.ssh/authorized_keys file. This is the correct answer to the question. The other options are incorrect because they are not the standard locations for the public keys for the server (~/.sshd/authkeys, ~/.ssh/keys, or ~/.ssh/keyauth). References: CompTIA Linux+ (XK0-005) Certification Study Guide, Chapter 17: Implementing Basic Security, page 513.
DRAG DROP You have been asked to parse a log file of logins to determine various information about who is logging in and when. INSTRUCTIONS Open and inspect the Login log file. Drag and drop the correct commands onto the output that was generated from that command. Tokens can be used only once and not all will be used. If at any time you would like to bring back the initial state of the simulation, please click the Reset All button. 
Reveal answer details
Close answer details
Question 21
Single choice
A user is cleaning up a directory because it has more than 100,000 files that were generated from an experiment. When the user tries to remove the unneeded experiment files, the user receives an error: arduino cannot execute [Argument list too long] Which of the following should the user execute to remove these files?
-
A
find . -name "experiment*.txt" -exec rm "{}" ;
-
B
-
C
rm --force experiment*.txt
-
D
for i in experiment*.txt; do find . -name $i -exec rmdir "{}" ; done
Reveal answer details
Close answer details
Correct answerA
ExplanationThe "Argument list too long" error occurs when the number of files exceeds the command-line argument limit. The find command with -exec is a workaround, as it processes files one by one, avoiding the argument limit. This method is efficient for handling large numbers of files.
Question 22
Single choice
A Linux administrator is working on a system and notices that some of the packages are not at the latest version. Which of the following commands should the administrator use to correct this issue?
-
A
-
B
-
C
-
D
Reveal answer details
Close answer details
Correct answerB
ExplanationThe apt update command updates the package lists for repositories but does not upgrade installed packages. After apt update, the administrator should run apt upgrade to install the latest versions of all packages. rpm --update is incorrect because RPM does not have an --update option for updating repositories. RPM package management requires yum or dnf on RHEL- based systems. dnt update is not a valid command (probably a typo for dnf update, which would be used on Fedora/RHEL systems). dpkg --update is incorrect because dpkg is used for managing individual .deb packages and does not update repositories. References: CompTIA Linux+ Official Study Guide, Chapter on Package Management
Question 23
Single choice
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
-
B
/etc/security/limits.conf
-
C
-
D
Reveal answer details
Close answer details
Correct answerA
ExplanationThe required changes need to be made to the /etc/login.defs configuration file. The /etc/login.defs file defines the default values for user and group IDs, passwords, shells, and other parameters for user and group creation. The file contains the directives UID_MIN, UID_MAX, GID_MIN, and GID_MAX, which set the minimum and maximum values for automatic user and group ID selection. The administrator can edit this file and change the values to match the organization's new cybersecurity policies. This is the correct file to modify to accomplish the task. The other options are incorrect because they either do not affect the user and group IDs (/etc/security/limits.conf or /etc/profile) or do not set the default values (/ etc/default/ useradd). References: CompTIA Linux+ (XK0-005) Certification Study Guide, Chapter 15: Managing Users and Groups, page 463.
Question 24
Single choice
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?
-
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
Reveal answer details
Close answer details
Correct answerD
ExplanationThe filesystem is in read-only mode, likely due to corruption or errors detected. Running fsck -y will check and repair the filesystem, and mount -o rw,remount will remount it as read-write, making it usable again. This is a common troubleshooting step for filesystems with errors.
Question 25
Single choice
An administrator logs in to a Linux server and notices the clock is 37 minutes fast. Which of the following commands will fix the issue?
-
A
-
B
-
C
-
D
Reveal answer details
Close answer details
Question 26
Single choice
A systems administrator needs to know the mail exchange (MX) record for the foo.com domain. Which of the following commands will accomplish this task?
-
A
-
B
-
C
-
D
Reveal answer details
Close answer details
Correct answerB
ExplanationThe dig command is used for querying DNS information. To retrieve the MX records for a domain (which indicate where emails should be routed), the command dig mx foo.com is used. This returns the mail servers associated with the domain, including their priority levels.
Question 27
Single choice
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?
-
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
Reveal answer details
Close answer details
Correct answerC
ExplanationThe REJECT target sends back an error packet to the source IP address, indicating that the connection is refused by the firewall. This is different from the DROP target, which silently discards the packet without any response. The RETURN target returns to the previous chain, which may or may not accept the connection. The QUEUE target passes the packet to a userspace application for further processing, which is not the desired outcome in this case. References CompTIA Linux+ (XK0-005) Certification Study Guide, page 316 iptables - ssh - access from specific ip only - Server Fault, answer by Eugene Ionichev
Question 28
Single choice
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
Reveal answer details
Close answer details
Correct answerB
ExplanationThe command iptables -t filter -A INPUT -p tcp --dport 4000:5000 -j ACCEPT will enforce the rule of allowing incoming traffic to ports in the range of 4000 to 5000 on a Linux server. The iptables command is a tool for managing firewall rules on Linux systems. The -t option specifies the table to operate on, in this case filter, which is the default table that contains the rules for filtering packets. The -A option appends a new rule to the end of a chain, in this case INPUT, which is the chain that processes the packets that are destined for the local system. The -p option specifies the protocol to match, in this case tcp, which is the transmission control protocol. The --dport option specifies the destination port or port range to match, in this case 4000:5000, which is the range of ports from 4000 to 5000. The -j option specifies the target to jump to if the rule matches, in this case ACCEPT, which is the target that allows the packet to pass through. The command iptables -t filter -A INPUT -p tcp --dport 4000:5000 -j ACCEPT will add a new rule to the end of the INPUT chain that will accept the incoming TCP packets that have a destination port between 4000 and 5000. This command will enforce the rule and allow the traffic to the specified ports. This is the correct command to use to accomplish the task. The other options are incorrect because they either use the wrong options (-f instead of - t or -D instead of -A) or do not exist (iptables filter -A INPUT -p tcp --dport 4000:5000 -D ACCEPT or iptables filter -S INPUT -p tcp --dport 4000:5000 -A ACCEPT). References: CompTIA Linux+ (XK0-005) Certification Study Guide, Chapter 18: Securing Linux Systems, page 543.
Question 29
Single choice
An administrator needs to increase the system priority of a process with PID 2274. Which of the following commands should the administrator use to accomplish this task?
-
A
-
B
-
C
echo "--15" > /proc/PID/2274/priority
-
D
Reveal answer details
Close answer details
Correct answerA
ExplanationThe renice command is used to change the priority of a running process by specifying its PID and the new nice value. The -n flag indicates the amount of change in the nice value, which can be positive or negative. A lower nice value means a higher priority, so -15 will increase the priority of the process with PID 2274. The administrator needs to have root privileges to do this. References: The renice command is listed as one of the commands to manipulate process priority in the web search result 1. The renice command is also explained with examples in the web search result 2. The CompTIA Linux+ Certification Exam Objectives mention that the candidate should be able to "manage process execution priorities" as part of the System Operation and Maintenance domain 1.
Question 30
Single choice
A Linux administrator was notified that a virtual server has an I/O bottleneck. The Linux administrator analyzes the following output:  Given there is a single CPU in the sever, which of the following is causing the slowness?
-
A
The system is running out of swap space.
-
B
-
C
-
D
The processes are paging.
Reveal answer details
Close answer details
Correct answerB
ExplanationThe slowness is caused by the CPU being overloaded. The iostat command shows that the CPU utilization is 100%, which means that there are more processes competing for CPU time than the CPU can handle. The other options are incorrect because: The system is not running out of swap space, as shown by the iostat command, which shows that there is no swap activity (si and so columns are zero). The memory is not exhausted, as shown by the free -m command, which shows that there is still available memory (avail column) and free buffer/cache memory (buff/cache column). The processes are not paging, as shown by the vmstat command, which shows that there are no major page faults (majflt column) and no swap activity (si and so columns). References: CompTIA Linux+ Study Guide, Fourth Edition, page 417- 419, 424-425.
Question 31
Single choice
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?
-
A
-
B
-
C
-
D
Reveal answer details
Close answer details
Correct answerC
ExplanationThe Linux administrator should configure /etc/yum.repos.d/db.repo so that the requested packages can be installed. This file defines a custom repository for yum, which is a package manager for RPM-based systems. The file should contain information such as the name, baseurl, gpgcheck, and enabled options for the repository. By creating this file and enabling the repository, the administrator can use yum to install packages from the custom repository. The /etc/yum.conf file is the main configuration file for yum, but it does not define repositories. The /etc/ssh/sshd.conf file is the configuration file for sshd, which is a daemon that provides secure shell access to remote systems. The /etc/resolv.conf file is the configuration file for DNS resolution, which maps domain names to IP addresses. References: CompTIA Linux+ (XK0-005) Certification Study Guide, Chapter 19: Managing Packages and Software, page 559.
Question 32
Single choice
A systems administrator is tasked with creating a cloud-based server with a public IP address.  Which of the following technologies did the systems administrator use to complete this task?
-
A
-
B
-
C
-
D
Reveal answer details
Close answer details
Correct answerD
ExplanationThe systems administrator used Terraform to create a cloud-based server with a public IP address. Terraform is a tool for building, changing, and versioning infrastructure as code. Terraform can create and manage resources on different cloud platforms, such as AWS, Azure, or Google Cloud. Terraform uses a declarative syntax to describe the desired state of the infrastructure and applies the changes accordingly. Terraform can also assign a public IP address to a cloud server by using the appropriate resource attributes. This is the correct technology that the systems administrator used to complete the task. The other options are incorrect because they are either not designed for creating cloud servers (Puppet or Git) or not capable of assigning public IP addresses (Ansible). References: CompTIA Linux+ (XK0-005) Certification Study Guide, Chapter 19: Managing Cloud and Virtualization Technologies, page 559.
Question 33
Single choice
A systems administrator wants to check for running containers. Which of the following commands can be used to show this information?
-
A
-
B
-
C
-
D
Reveal answer details
Close answer details
Correct answerC
ExplanationThe command that can be used to check for running containers is docker ps. The docker ps command can list all the containers that are currently running on the system. To show all the containers, including those that are stopped, the administrator can use docker ps -a ? References: [CompTIA Linux+ Study Guide], Chapter 11: Working with Containers, Section: Managing Containers with Docker [Docker PS Command with Examples]
Question 34
Single choice
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?
-
A
-
B
-
C
-
D
Reveal answer details
Close answer details
Correct answerC
ExplanationThe ~/.ssh/config file can be used to set various options for SSH connections, including the port number, for specific hosts or groups of hosts. This file is located in the user's home directory and affects only the current user. The /etc/ssh/ sshd_config file is used to configure the SSH server daemon, not the client. The /etc/ssh/moduli file contains parameters for Diffie-Hellman key exchange, not port settings. The ~/.ssh/ authorized_keys file contains public keys for authentication, not port settings. References: CompTIA Linux + (XK0-005) Certification Study Guide, Chapter 12: Secure Shell (SSH), page 414.
Question 35
Multiple choice
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
-
F
echo "net.ipv6.conf.all.forwarding=l" >> /etc/sysctl.conf
Reveal answer details
Close answer details
Correct answersB, E
ExplanationThe 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. References: sysctl(8) - Linux manual page Configure Linux as a Router (IP Forwarding)
Question 36
Multiple choice
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
-
B
-
C
growpart /dev/mapper/rootvg-rootlv
-
D
-
E
lvresize -L +10G -r /dev/mapper/rootvg-rootlv
-
F
-
G
parted -l /dev/mapper/rootvg-rootlv
-
H
vgextend /dev/rootvg /dev/sdb
Reveal answer details
Close answer details
Correct answersA, C, E
ExplanationThe administrator should use the following three commands to resolve the issue of the root filesystem being full: df -h /. This command will show the disk usage of the root filesystem in a human-readable format. The df command is a tool for reporting file system disk space usage. The -h option displays the sizes in powers of 1024 (e.g., 1K, 234M, 2G). The / specifies the root filesystem. The command df -h / will show the total size, used space, available space, and percentage of the root filesystem. This command will help the administrator identify the problem and plan the solution. growpart /dev/mapper/rootvg-rootlv. This command will grow the partition that contains the root filesystem to the maximum size available. The growpart command is a tool for resizing partitions on Linux systems. The /dev/mapper/rootvg-rootlv is the device name of the partition, which is a logical volume managed by the Logical Volume Manager (LVM). The command growpart /dev/mapper/rootvg-rootlv will extend the partition to fill the disk space and increase the size of the root filesystem. This command will help the administrator solve the problem and free up space. lvresize -L +10G -r /dev/mapper/rootvg-rootlv. This command will resize the logical volume that contains the root filesystem and add 10 GB of space. The lvresize command is a tool for resizing logical volumes on Linux systems. The -L option specifies the new size of the logical volume, in this case +10G, which means 10 GB more than the current size. The -r option resizes the underlying file system as well. The /dev/ mapper/rootvg-rootlv is the device name of the logical volume, which is the same as the partition name. The command lvresize -L +10G -r /dev/mapper/rootvg-rootlv will increase the size of the logical volume and the root filesystem by 10 GB and free up space. This command will help the administrator solve the problem and free up space. The other options are incorrect because they either do not affect the root filesystem (fdisk - 1 /dev/sdb, pvcreate /dev/sdb, lsblk /dev/sda, or vgextend /dev/rootvg /dev/sdb) or do not use the correct syntax (fdisk -1 /dev/sdb instead of fdisk -l /dev/sdb or parted -l /dev/mapper/rootvg-rootlv instead of parted /dev/mapper/rootvg-rootlv print). References: CompTIA Linux+ (XK0-005) Certification Study Guide, Chapter 10: Managing Storage, pages 318-319, 331-332.
Question 37
Single choice
A Linux administrator needs to rebuild a container with the httpd service in order to change some default parameters. Which of the following should be the first command line in the Dockerfile?
-
A
-
B
-
C
-
D
Reveal answer details
Close answer details
Correct answerA
ExplanationIn Docker, a Dockerfile is a script that contains instructions to build a container image. The first line in a Dockerfile is typically the FROM directive, which specifies the base image from which the container will be built. The correct syntax for specifying a base image is:rubyCopyEditFROM <image>:<tag>If no tag is provided, Docker will pull the latest version of the specified image by default. httpd is the official Apache HTTP Server image available in Docker Hub. The incorrect options: Thus, the correct answer is A. FROM httpd.
Question 38
Single choice
Rugged appliances are small appliances with ruggedized hardware and like Quantum Spark appliance they use which operating system?
-
A
-
B
-
C
-
D
Red Hat Enterprise Linux version 5
Reveal answer details
Close answer details
Correct answerB
ExplanationRugged appliances are small appliances with ruggedized hardware that use Gaia embedded as their operating system. Gaia embedded is a version of Gaia that is optimized for embedded devices such as Rugged appliances and Quantum Spark appliances. Gaia embedded supports features such as VPN, firewall, identity awareness, application control, URL filtering, and anti-bot. Gaia embedded does not use Centos Linux, Gaia, or Red Hat Enterprise Linux version 5 as their operating system. References: Check Point Rugged Appliance Datasheet, page 1.
Question 39
Single choice
A Linux administrator needs to remove all local firewall rules on a Linux system. Which of the following commands should the administrator run?
-
A
-
B
-
C
-
D
Reveal answer details
Close answer details
Correct answerC
ExplanationThe iptables -F command flushes all the firewall rules, effectively removing them from the system. This command clears out all existing rules from all chains (INPUT, OUTPUT, and FORWARD), leaving the system with no active iptables rules.
Question 40
Single choice
Linux system users report that over the past few months, a server has stopped responding at least twice each day. Every time this happens, the users have to restart the server to recover it. A systems administrator diagnosing the issue collects the following outputs: csharp Output 1 [Tue Aug 31 16:36:42 2021] oom-killer invoked by java: gfp_mask=0x280da2 order=0, oom_score_adj=0 [Tue Aug 31 16:36:42 2021] java cpuset=/ mems_allowed=0 makefile Output 2 [root@server]# free -m total used free shared buff/cache available Mem: 15819 15026 174 92 619 134 Swap: 0 0 0 Which of the following is the best permanent resolution for the system?
-
A
-
B
-
C
-
D
Reveal answer details
Close answer details
Correct answerA
ExplanationThe oom-killer is invoked when the system runs out of memory, as indicated by the memory usage in the free -m output. Since swap space is not being used and physical memory is almost entirely consumed, adding more memory resources will prevent the system from running out of memory and invoking the oom-killer to terminate processes.
Question 41
Single choice
A Linux administrator has been tasked with installing the most recent versions of packages on a RPM-based OS. Which of the following commands will accomplish this task?
-
A
-
B
-
C
-
D
-
E
Reveal answer details
Close answer details
Correct answerD
ExplanationThe dnf update command will accomplish the task of installing the most recent versions of packages on a RPM-based OS. This command will check for available updates from the enabled repositories and apply them to the system. The apt-get upgrade command is used to install updates on a Debian-based OS, not a RPM-based OS. The rpm -a command is invalid, as -a is not a valid option for rpm. The yum updateinfo command will display information about available updates, but it will not install them. The yum check-update command will check for available updates, but it will not install them. References: CompTIA Linux+ (XK0-005) Certification Study Guide, Chapter 19: Managing Packages and Software, page 559.
Question 42
Multiple choice
A new Linux systems administrator just generated a pair of SSH keys that should allow connection to the servers. Which of the following commands can be used to copy a key file to remote servers? (Choose two.)
-
A
-
B
-
C
-
D
-
E
-
F
Reveal answer details
Close answer details
Correct answersD, F
ExplanationThe commands ssh-copy-id and scp can be used to copy a key file to remote servers. The command ssh-copy-id copies the public key to the authorized_keys file on the remote server, which allows the user to log in without a password. The command scp copies files securely over SSH, which can be used to transfer the key file to any location on the remote server. The other options are incorrect because they are not related to copying key files. The command wget downloads files from the web, the command ssh-keygen generates key pairs, the command ssh-keyscan collects public keys from remote hosts, and the command ftpd is a FTP server daemon. References: CompTIA Linux+ (XK0-005) Certification Study Guide, Chapter 13: Managing Network Services, pages 408-410.
Question 43
Single choice
A Linux administrator encounters the following error in the Apache log files: css SQLSTATE[HY000] [2002] Permission denied Which of the following commands should the administrator run to safely fix this issue?
-
A
chcon -c httpd_sys_content_t /home/apache
-
B
setsebool -F httpd_can_network_connect_db on
-
C
-
D
Reveal answer details
Close answer details
Correct answerB
ExplanationThe error indicates that SELinux is preventing Apache from connecting to the database. The command setsebool -F httpd_can_network_connect_db on allows the Apache web server to make network connections to the database, resolving the permission denied error without disabling SELinux entirely.
Question 44
Single choice
A developer is unable to access a Linux server via SSH. Given the following output: SSH server configuration (/etc/ssh/sshd_config): PermitRootLogin no PubkeyAuthentication yes PasswordAuthentication yes GSSAPIAuthentication yes X11Forwarding no User Information (/etc/passwd): developer:x:1000:1000:comptia:/home/developer:/bin/bash User Shadow File (/etc/shadow): developer:!!::0:99999:7::: Which of the following explains why the developer is unable to log in to the server?
-
A
The developer's private key has been deleted from the server.
-
B
The developer's account has been locked out.
-
C
The developer's public key is in the wrong location.
-
D
SSH has been disabled for user log-in.
Reveal answer details
Close answer details
Correct answerB
ExplanationThe reason the developer cannot log in is because their account is locked. This is indicated by the "!!" in the /etc/shadow file: developer:!!::0:99999:7::: The "!!" in the password field means the account is locked, and the user cannot authenticate using a password. To unlock the account, the administrator must reset the password: passwd developer OR, if SSH key authentication is used, the administrator can remove the lock without setting a password: usermod -U developer References: CompTIA Linux+ Official Documentation
Question 45
Single choice
Which of the following commands is used to configure the default permissions for new files?
-
A
-
B
-
C
-
D
Reveal answer details
Close answer details
Correct answerC
ExplanationThe command that is used to configure the default permissions for new files is umask. The umask command is a tool for setting the default permissions for new files and directories on Linux systems. The umask value is a four-digit octal number that represents the permissions that are subtracted from the default permissions. The default permissions for files are 666, which means read and write for owner, group, and others. The default permissions for directories are 777, which means read, write, and execute for owner, group, and others. The umask value consists of four digits: the first digit is for special permissions, such as setuid, setgid, and sticky bit; the second digit is for the owner permissions; the third digit is for the group permissions; and the fourth digit is for the others permissions. The umask value can be calculated by subtracting the desired permissions from the default permissions. For example, if the desired permissions for files are 664, which means read and write for owner and group, and read for others, then the umask value is 002, which is 666 - 664. The command umask 002 will set the umask value to 002, which will ensure that only file owners and group members can modify new files by default. The command that is used to configure the default permissions for new files is umask. This is the correct answer to the question. The other options are incorrect because they either do not set the default permissions for new files (setenforce, sudo, or chmod) or do not exist (kill -HUP or kill -TERM). References: CompTIA Linux+ (XK0-005) Certification Study Guide, Chapter 11: Managing File Permissions and Ownership, page 349.
Question 46
Single choice
A systems technician is working on deploying several microservices to various RPM-based systems, some of which could run up to two hours. Which of the following commands will allow the technician to execute those services and continue deploying other microservices within the same terminal section?
-
A
-
B
-
C
-
D
Reveal answer details
Close answer details
Correct answerD
ExplanationThe command that will allow the technician to execute the services and continue deploying other microservices within the same terminal session is bg %1 job name. This command will send the job with ID 1 and name job name to the background, where it will run without occupying the terminal. The other options are incorrect because: gedit & disown will launch a graphical text editor in the background and detach it from the terminal, but it will not execute any service. kill 9 %1 will terminate the job with ID 1 using a SIGKILL signal, which cannot be ignored or handled by the process. fg %1 will bring the job with ID 1 to the foreground, where it will occupy the terminal until it finishes or is stopped. References: CompTIA Linux+ Study Guide, Fourth Edition, page 181-182.
Question 47
Single choice
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?
-
A
-
B
-
C
-
D
Reveal answer details
Close answer details
Correct answerB
ExplanationTo prevent certain files from being tracked by Git, the administrator can use a .gitignore file (B) in the repository. The .gitignore file can specify patterns of files or directories that Git should ignore. This way, the Terraform state files will not appear in the main branch or any other branch. The other commands are not related to this requirement. References: [CompTIA Linux+ Study Guide], Chapter 10: Working with Git, Section: Ignoring Files with .gitignore [How to Use .gitignore File]
DRAG DROP You have been asked to parse a log file of logins to determine various information about who is logging in and when. INSTRUCTIONS Open and inspect the Login log file. Drag and drop the correct commands onto the output that was generated from that command. Tokens can be used only once and not all will be used. If at any time you would like to bring back the initial state of the simulation, please click the Reset All button. 
Reveal answer details
Close answer details
Question 49
Single choice
A systems technician is configuring an application server to accept packets from a trusted source with the IP address 192.168.10.22. Which of the following commands will allow communication between the two servers?
-
A
iptables -L -s 192.168.10.22 -j ACCEPT
-
B
iptables -D INPUT -s 192.168.10.22 -j ACCEPT
-
C
iptables -A INPUT -s 192.168.10.22 -j ACCEPT
-
D
iptables -A OUTPUT -S 192.168.10.22 -j ACCEPT
Reveal answer details
Close answer details
Correct answerC
ExplanationThe iptables command is used to configure firewall rules in Linux.To allow packets from a specific source (192.168.10.22) to the server, we must append a rule to the INPUT chain: iptables -A INPUT -s 192.168.10.22 -j ACCEPT Explanation of the command: Why the other options are incorrect? Persisting the Rule: To make the rule persistent after a reboot, it must be saved: iptables-save > /etc/iptables/rules.v4 References: CompTIA Linux+ Official Documentation
Question 50
Single choice
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
-
C
-
D
dnf history and dnf history undo last
Reveal answer details
Close answer details
Correct answerD
ExplanationThe commands that will list and remove the corresponding packages are dnf history and dnf history undo last. The dnf history command will display a list of all transactions performed by dnf, such as installing, updating, or removing packages. Each transaction has a unique ID, a date and time, an action, and a number of altered packages. The dnf history undo last command will undo the last transaction performed by dnf, meaning that it will reverse all package changes made by that transaction. For example, if the last transaction installed some packages, dnf history undo last will remove them. The other options are not correct commands for listing and removing corresponding packages. The dnf list command will display a list of available packages in enabled repositories, but not the packages installed by dnf transactions. The dnf remove command will remove specified packages from the system, but not all packages from a specific transaction. The dnf info command will display detailed information about specified packages, but not about dnf transactions. The dnf upgrade command will upgrade all installed packages to their latest versions, but not undo any package changes. References: Handling package management history dnf(8) - Linux manual page
Question 51
Single choice
Due to performance issues on a server, a Linux administrator needs to termi-nate an unresponsive process. Which of the following commands should the administrator use to terminate the process immediately without waiting for a graceful shutdown?
-
A
-
B
-
C
-
D
Reveal answer details
Close answer details
Correct answerA
ExplanationTo terminate an unresponsive process immediately without waiting for a graceful shutdown, the administrator can use the command kill -SIGKILL 5545 (A). This will send a signal to the process with the PID 5545 that cannot be ignored or handled by the process, and force it to stop. The other commands will send different signals that may allow the process to perform some cleanup or termination actions, or may be ignored by the process. References: [CompTIA Linux+ Study Guide], Chapter 6: Managing Processes, Section: Killing Processes [How to Kill Processes in Linux]
Question 52
Single choice
Users are reporting that a Linux server is responding slowly. A systems administrator troubleshooting the server issue sees the following:   Which of the following is most likely the issue?
-
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.
Reveal answer details
Close answer details
Question 53
Single choice
Which of the following commands should a technician use to create an administrative account for the username Joe?
-
A
sudo useradd -G wheel joe
-
B
sudo useradd joe; sudo passwd -l joe
-
C
sudo useradd joe; sudo cat key.pem > ~/.ssh/authorized_keys
-
D
sudo useradd joe; groupadd admin joe
Reveal answer details
Close answer details
Correct answerA
ExplanationThe -G wheel option adds the user joe to the wheel group, which is a special group that allows users to execute administrative commands using sudo. This is the correct way to create a user with administrative privileges in many Linux distributions, including Red Hat-based ones.
Question 54
Single choice
At what point is the Internal Certificate Authority (ICA) created?
-
A
During the primary Security Management Server installation process.
-
B
Upon creation of a certificate.
-
C
When an administrator decides to create one.
-
D
When an administrator initially logs into SmartConsole.
Reveal answer details
Close answer details
Correct answerA
ExplanationThe Internal Certificate Authority (ICA) is created during the primary Security Management Server installation process. The ICA is a component of Check Point's Public Key Infrastructure (PKI) that issues and manages certificates for Security Gateways and administrators. The ICA is automatically installed and initialized when the primary Security Management Server is installed. The ICA is not created upon creation of a certificate, when an administrator decides to create one, or when an administrator initially logs into SmartConsole. References: Check Point Certified Security Administrator (CCSA) R80.x Study Guide, Chapter 3: Check Point Security Management Architecture, page 32.
Question 55
Single choice
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?
-
A
usermod -d /srv/www-data www-data && usermod -d /var/lib/db db
-
B
passwd -u www-data && passwd -u db
-
C
renice -n 1002 -u 502 && renice -n 1005 -u 505
-
D
chsh -s /bin/false www-data && chsh -s /bin/false db
Reveal answer details
Close answer details
Correct answerD
ExplanationThis 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 system 1. This will prevent unauthorized access attempts and improve security. References: 1: Replacing /bin/bash with /bin/false in /etc/passwd file
Question 56
Single choice
The application team is having issues accessing their data in their /app filesystem. Given the following outputs:  Which of the following is the reason for this issue?
-
A
The fllesystem was mounted incorrectly.
-
B
The /etc/fstab configuration is wrong.
-
C
A physical volume is missing.
-
D
The data has been deleted.
Reveal answer details
Close answer details
Question 57
Single choice
A Linux administrator logs into a system and identifies that an important backup has 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?
-
A
renice -n 15 -p <backup pid>
-
B
nice -n 15 -p <backup pid>
-
C
renice -n -15 -p <backup pid>
-
D
nice -n -15 -p <backup pid>
Reveal answer details
Close answer details
Correct answerA
ExplanationThe renice command changes the scheduling priority of a running process. By using renice -n 15, the administrator lowers the priority of the backup process, making it less CPU-intensive and reducing its impact on other system services. A positive niceness value (e.g., 15) lowers the priority, allowing other processes to receive more CPU time.
Question 58
Single choice
A Linux administrator is reviewing changes to a configuration file that includes the following section:  The Linux administrator is trying to select the appropriate syntax formatter to correct any issues with the configuration file. Which of the following should the syntax formatter support to meet this goal?
-
A
-
B
-
C
-
D
Reveal answer details
Close answer details
Correct answerC
ExplanationThe configuration file shown in the image is written in YAML format, so the syntax formatter should support YAML to correct any issues with the file. YAML stands for YAML Ain't Markup Language, and it is a human-readable data serialization language that uses indentation and colons to define key-value pairs. YAML supports various data types, such as scalars, sequences, mappings, anchors, aliases, and tags. The configuration file follows the rules and syntax of YAML, while the other options do not. Markdown is a lightweight markup language that uses plain text formatting to create rich text documents. XML is a markup language that uses tags to enclose elements and attributes. JSON is a data interchange format that uses curly braces to enclose objects and square brackets to enclose arrays. References: CompTIA Linux+ (XK0-005) Certification Study Guide, Chapter 21: Automating Tasks with Ansible, page 591.
Question 59
Single choice
A Linux administrator is updating the file that contains the addresses of the software and update repositories on an Ubuntu system. Which of the following files needs to be edited to accomplish this task?
-
A
-
B
/etc/apt/listchanges.conf
-
C
-
D
Reveal answer details
Close answer details
Question 60
Single choice
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
-
B
-
C
-
D
Reveal answer details
Close answer details
Correct answerA
ExplanationThe command docker images prune -a will help to remove all dangling images and delete all the images that do not have an associated container. The docker command is a tool for managing Docker containers and images. The images subcommand operates on images. The prune option removes unused images. The -a option removes all images, not just dangling ones. A dangling image is an image that is not tagged and is not referenced by any container. This command will accomplish the task of cleaning up the unused images. The other options are incorrect because they either do not exist (docker push images -a or docker images rmi --all) or do not remove images (docker rmi -a images only removes images that match the name or ID of "images"). References: CompTIA Linux+ (XK0-005) Certification Study Guide, Chapter 19: Managing Cloud and Virtualization Technologies, page 567.
Question 61
Single choice
A DevOps engineer needs to download a Git repository from https://git.company.com/admin/project.git.Whichofthefollowingcommandswillachievethisgoal?
-
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
Reveal answer details
Close answer details
Correct answerA
ExplanationThe command git clone https://git.company.com/admin/project.git will achieve the goal of downloading a Git repository from the given URL. The git command is a tool for managing version control systems. The clone option creates a copy of an existing repository. The URL specifies the location of the repository to clone, in this case https://git.company.com/admin/project.git. The command git clone https://git.company.com/admin/project.git will download the repository and create a directory named project in the current working directory. This is the correct command to use to accomplish the goal. The other options are incorrect because they either do not download the repository (git checkout, git pull, or git branch) or do not use the correct syntax (git checkout https://git.company.com/admin/project.git instead of git checkout -b project https://git.company.com/admin/project.git or git branch https://git.company.com/admin/project.git instead of git branch project https://git.company.com/admin/project.git). References: CompTIA Linux+ (XK0-005) Certification Study Guide, Chapter 19: Managing Cloud and Virtualization Technologies, page 571.
Question 62
Single choice
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
Reveal answer details
Close answer details
Correct answerB
ExplanationThe command dd if=/dev/sda of=/tmp/sda.img should be used to create an image named sda.img from the sda disk and store it in the /tmp directory. The dd command is a tool for copying and converting data on Linux systems. The if option specifies the input file or device, in this case /dev/sda, which is the disk device. The of option specifies the output file or device, in this case /tmp/sda.img, which is the image file. The command dd if=/dev/sda of=/tmp/sda.img will copy the entire disk data from /dev/sda to /tmp/sda.img and create an image file. This is the correct command to use to accomplish the task. The other options are incorrect because they either use the wrong options (--if or --of instead of if or of) or swap the input and output (dd of=/dev/sda if=/tmp/sda.img or dd --of=/dev/sda --if=/tmp/sda.img). References: CompTIA Linux + (XK0-005) Certification Study Guide, Chapter 10: Managing Storage, page 323.
Question 63
Single choice
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
-
B
-
C
-
D
Reveal answer details
Close answer details
Correct answerA
ExplanationThe command chmod 755 filename.log should be used to set filename.log permissions to -rwxr--r--. The chmod command is a tool for changing file permissions on Linux file systems. The permissions can be specified in octal notation, where each digit represents the permissions for the owner, group, and others respectively. The permissions are encoded as follows: 0: no permission 1: execute permission 2: write permission 4: read permission 5: read and execute permissions (4 + 1) 6: read and write permissions (4 + 2) 7: read, write, and execute permissions (4 + 2 + 1) The command chmod 755 filename.log will set the permissions to -rwxr--r--, which means that the owner has read, write, and execute permissions (7), the group has read and execute permissions (5), and others have read and execute permissions (5). This is the correct command to use to accomplish the task. The other options are incorrect because they either set the wrong permissions (chmod 640, chmod 740, or chmod 744) or do not exist (chmod -G). References: CompTIA Linux+ (XK0-005) Certification Study Guide, Chapter 11: Managing Files and Directories, page 345.
Question 64
Single choice
An administrator added the port 2222 for the SSH server on myhost and restarted the SSH server. The administrator noticed issues during the startup of the service. Given the following outputs:  Which of the following commands will fix the issue?
-
A
semanage port -a -t ssh_port_t -p tcp 2222
-
B
chcon system_u:object_r:ssh_home_t /etc/ssh/*
-
C
iptables -A INPUT -p tcp -- dport 2222 -j ACCEPT
-
D
firewall-cmd -- zone=public -- add-port=2222/tcp
Reveal answer details
Close answer details
Correct answerA
ExplanationThe correct answer is A. semanage port -a -t ssh_port_t -p tcp 2222 This command will allow the SSH server to bind to port 2222 by adding it to the SELinux policy. The semanage command is a utility for managing SELinux policies. The port subcommand is used to manage network port definitions. The -a option is used to add a new record, the -t option is used to specify the SELinux type, the -p option is used to specify the protocol, and the tcp 2222 argument is used to specify the port number. The ssh_port_t type is the default type for SSH ports in SELinux. The other options are incorrect because: B. chcon system_u:object_r:ssh_home_t /etc/ssh/* This command will change the SELinux context of all files under /etc/ssh/ to system_u:object_r:ssh_home_t, which is not correct. The ssh_home_t type is used for user home directories that are accessed by SSH, not for SSH configuration files. The correct type for SSH configuration files is sshd_config_t. C. iptables -A INPUT -p tcp --dport 2222 -j ACCEPT This command will add a rule to the iptables firewall to accept incoming TCP connections on port 2222. However, this is not enough to fix the issue, as SELinux will still block the SSH server from binding to that port. Moreover, iptables may not be the default firewall service on some Linux distributions, such as Fedora or CentOS, which use firewalld instead. D. firewall-cmd --zone=public --add-port=2222/tcp This command will add a rule to the firewalld firewall to allow incoming TCP connections on port 2222 in the public zone. However, this is not enough to fix the issue, as SELinux will still block the SSH server from binding to that port. Moreover, firewalld may not be installed or enabled on some Linux distributions, such as Ubuntu or Debian, which use iptables instead. References: How to configure SSH to use a non-standard port with SELinux set to enforcing Change SSH Port on CentOS/RHEL/Fedora With SELinux Enforcing How to change SSH port when SELinux policy is enabled
Question 65
Single choice
A Linux administrator changed a systemd configuration. However, the change was not applied after the system was restarted. Which of the following commands is required to apply the change?
-
A
-
B
-
C
-
D
Reveal answer details
Close answer details
Correct answerC
ExplanationWhen making changes to systemd configuration files (such as unit files), the systemctl daemon-reload command must be run to reload the systemd manager configuration. systemctl enable only enables a service to start at boot but does not apply configuration changes immediately. systemctl restart restarts a specific service but does not reload the systemd daemon itself. The missing option appears to be an unrelated or incorrect command. References: CompTIA Linux+ Official Study Guide, Chapter on Systemd and Service Management
Question 66
Single choice
A systems administrator is compressing old log files in order to save space. Which of the following commands will allow the administrator to save the most space?
-
A
-
B
-
C
-
D
Reveal answer details
Close answer details
Question 67
Single choice
Which of the following can be used as a secure way to access a remote termi-nal?
-
A
-
B
-
C
-
D
Reveal answer details
Close answer details
Correct answerB
ExplanationSSH, or Secure Shell, is a protocol that allows you to access a remote terminal or virtual machine securely over an encrypted connection. You can use SSH to run commands, transfer files, or tunnel network traffic on a remote system. To use SSH, you need an SSH client program on your local system and an SSH server program on the remote system. You also need to authenticate yourself using a username and password or a public/private key pair. SSH is widely used by system administrators, developers, and engineers to remotely manage Linux servers and other devices. The other options are not correct answers. TFTP, or Trivial File Transfer Protocol, is a simple protocol that allows you to transfer files between systems, but it does not provide any security or encryption features. SCP, or Secure Copy Protocol, is a protocol that uses SSH to securely copy files between systems, but it does not provide a remote terminal access. FTP, or File Transfer Protocol, is another protocol that allows you to transfer files between systems, but it also does not provide any security or encryption features.
Question 68
Single choice
An administrator is running a web server in a container named web, but none of the error output is not showing. Which of the following should the administrator use to generate the errors on the container?
-
A
docker-compose inspect WEB
-
B
-
C
dockerrun --nameWEB --volume/dev/stdout:/var/log/nginx/error.log
-
D
Reveal answer details
Close answer details
Correct answerB
ExplanationThe docker logs command is used to fetch the logs of a container. If the error output is not showing for a running container, the docker logs command can be used to view these details 56. References: 5 (https://www.docker.com/blog/how-to-fix-and-debug-docker-containers-like-a-superhero/) 6 (https://stackoverflow.com/questions/33083385/getting-console-output-from-a-) docker-container)
Question 69
Single choice
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
-
D
Reveal answer details
Close answer details
Correct answerD
ExplanationThe command ssh-copy-id user@server will allow the user to upload the public key to a remote server and enable passwordless login. The ssh-copy-id command is a tool for copying the public key to a remote server and appending it to the authorized_keys file, which is used for public key authentication. The command will also set the appropriate permissions on the remote server to ensure the security of the key. The command ssh-copy-id user@server will copy the public key of the user to the server and allow the user to log in without a password. This is the correct command to use for this task. The other options are incorrect because they either do not copy the public key (scp, rsync, or ssh-add) or do not use the correct syntax (scp ~/.ssh/id_rsa user@server:~/ instead of scp ~/.ssh/id_rsa.pub user@server:~/ or rsync ~ /.ssh/ user@server:~/ instead of rsync ~/.ssh/id_rsa.pub user@server:~/). References: CompTIA Linux+ (XK0- 005) Certification Study Guide, Chapter 13: Managing Network Services, page 410.
Question 70
Single choice
An administrator started a long-running process in the foreground that needs to continue without interruption. Which of the following keystrokes should the administrator use to continue running the process in the background?
-
A
-
B
-
C
-
D
Reveal answer details
Close answer details
Correct answerA
ExplanationA long-running process is a program that takes a long time to complete or runs indefinitely on a Linux system. A foreground process is a process that runs in the current terminal and receives input from the keyboard and output to the screen. A background process is a process that runs in the background and does not interact with the terminal. A background process can continue running even if the terminal is closed or disconnected. To start a long-running process in the background, the user can append an ampersand (&) to the command, such as someapp &. This will run someapp in the background and return control to the terminal immediately. To move a long-running process from the foreground to the background, the user can use two keystrokes: Ctrl+Z and bg. The Ctrl+Z keystroke will suspend (pause) the foreground process and return control to the terminal. The bg keystroke will resume (continue) the suspended process in the background and detach it from the terminal. The statement B is correct. The statements A, C, and D are incorrect because they do not perform the desired task. The bg keystroke alone will not work unless there is a suspended process to resume. The Ctrl+B keystroke will not suspend the foreground process, but rather move one character backward in some applications. The jobs keystroke will list all processes associated with the current terminal. The bg & keystroke will cause an error because bg does not take any arguments. References: [How to Run Linux Processes in Background]
Question 71
Single choice
A cloud engineer needs to launch a container named web-01 in background mode. Which of the following commands will accomplish this task?
-
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
Reveal answer details
Close answer details
Correct answerD
ExplanationThe docker run -d --name web-01 httpd command will launch a container named web-01 in background mode. This command will create and start a new container from the httpd image, assign it the name web- 01, and run it in detached mode (-d), which means the container will run in the background without attaching to the current terminal. The docker builder -f --name web-01 httpd command is invalid, as builder is not a valid docker command, and -f and --name are not valid options for docker build. The docker load -- name web-01 httpd command is invalid, as load does not accept a --name option, and httpd is not a valid file name for load. The docker ps -a --name web-01 httpd command is invalid, as ps does not accept a -- name option, and httpd is not a valid filter for ps. References: CompTIA Linux+ (XK0-005) Certification Study Guide, Chapter 16: Virtualization and Cloud Technologies, page 499.
Question 72
Single choice
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?
-
A
-
B
-
C
-
D
Reveal answer details
Close answer details
Correct answerA
Explanationsystemctl status httpd is the correct option to check if the Apache web server (httpd) is running. The systemctl status command provides detailed information about the service, including whether it is active and running.
|