Practice Free XK0-005 Exam Online Questions
A Linux administrator needs to ensure that Java 7 and Java 8 are both locally available for developers to use when deploying containers. Currently only Java 8 is available.
Which of the following commands should the administrator run to ensure both versions are available?
- A . docker image load java:7
- B . docker image pull java:7
- C . docker image import java:7
- D . docker image build java:7
B
Explanation:
The command that the administrator should run to ensure that both Java 7 and Java 8 are locally available for developers to use when deploying containers is docker image pull java:7. This command will use the docker image pull subcommand to download the java:7 image from Docker Hub, which is the default registry for Docker images. The java:7 image contains Java 7 installed on a Debian-based Linux system. The administrator can also specify a different registry by using the syntax registry/repository:tag.
The other options are not correct commands for ensuring that both Java 7 and Java 8 are locally available for developers to use when deploying containers. The docker image load java:7 command will load an image from a tar archive or STDIN, not from a registry. The docker image import java:7 command will create a new filesystem image from the contents of a tarball, not from a registry. The docker image build java:7 command will build an image from a Dockerfile, not from a registry.
Reference: CompTIA Linux+ (XK0-005) Certification Study Guide, Chapter 18: Automating Tasks; docker image pull | Docker Docs
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
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.
Reference: 1: Replacing /bin/bash with /bin/false in /etc/passwd file
A systems administrator is investigating a service that is not starting up.
Given the following information:
Which of the following systemd commands should the administrator use in order to obtain more details about the failing service?
- A . systemct1 analyze network
- B . systemct1 info network
- C . sysctl -a network
- D . journalctl -xu network
D
Explanation:
The systemd is a system and service manager for Linux systems that provides a standard way to control and monitor system services. The systemd uses various commands and tools to manage and troubleshoot system services, such as systemct1, sysctl, and journalctl. The systemct1 command is used to start, stop, enable, disable, restart, reload, status, and list system services. The sysctl command is used to configure kernel parameters at runtime. The journalctl command is used to view and filter the logs of system services.
To investigate a service that is not starting up, the administrator can use the journalctl command with the -xu option. The -x option enables verbose output that includes explanatory text and priority information. The -u option filters the output by a specific unit name, such as network.service. Therefore, the command journalctl -xu network will show detailed logs of the network service, which can help identify the cause of the failure.
The statement D is correct.
The statements A, B, and C are incorrect because they do not provide more details about the failing service. The systemct1 analyze network command does not exist. The systemct1 info network command shows basic information about the network unit, such as description, load state, active state, sub state, and main PID. The sysctl -a network command shows all kernel parameters related to network settings.
Reference: [How to Use Systemd to Manage System Services]
A Linux administrator is alerted to a storage capacity issue on a server without a specific mount point or directory.
Which of the following commands would be MOST helpful for troubleshooting? (Choose two.)
- A . parted
- B . df
- C . mount
- D . du
- E . fdisk
- F . dd
- G . ls
B,D
Explanation:
To troubleshoot a storage capacity issue on a server without a specific mount point or directory, two commands that would be most helpful are df and du. The df command displays information about disk space usage on all mounted filesystems, including their size, used space, available space, and percentage of usage. The du command displays disk space usage by files and directories in a given path, which can help identify large files or directories that may be taking up too much space. The other commands are incorrect because they either do not show disk space usage, or they are used for other purposes such as partitioning, formatting, checking, mounting, copying, or listing files.
Reference: CompTIA Linux+ Study Guide, Fourth Edition, page 417-419.
A Linux engineer is removing a previously created firewall rule.
Which of the following commands will help the administrator accomplish this task?
- A . ufw delete 80/tcp
- B . ufw delete deny 80/tcp
- C . ufw delete 80/tcp deny
- D . delete7!
B
Explanation:
The ufw (Uncomplicated Firewall) delete command is used to remove rules.
If the original rule was ufw deny 80/tcp, it must be deleted with:
ufw delete deny 80/tcp
Why the other options are incorrect?
A systems administrator wants to permit access temporarily to an application running on port 1234/TCP on a Linux server.
Which of the following commands will permit this traffic?
- A . firewall-cmd ―new-service=1234/tcp
- B . firewall-cmd ―service=1234 ―protocol=tcp
- C . firewall-cmd ―add―port=1234/tcp
- D . firewall-cmd ―add-whitelist-uid=1234
C
Explanation:
The firewall-cmd command is used to manage firewalld, which is a firewall service for Linux systems that provides dynamic and persistent configuration of firewall rules. Firewalld uses zones and services to define different levels of trust and access for network connections.
To permit access temporarily to an application running on port 1234/TCP on a Linux server, the systems administrator can use the firewall-cmd –add-port=1234/tcp command. This command will add a rule to the default zone (usually public) that allows incoming traffic on port 1234/TCP. The rule will only be effective until the next reload or restart of firewalld. To make the rule permanent, the administrator can add the –permanent option to the command. The statement C is correct. The statements A, B, and D are incorrect because they do not permit access to port 1234/TCP.
The firewall-cmd –new-service=1234/tcp command does not exist. The firewall-cmd –service=1234 – -protocol=tcp command does not work because 1234 is not a predefined service name in firewalld. The firewall-cmd –add-whitelist-uid=1234 command does not exist.
Reference: [How to Use FirewallD to Manage Firewall in Linux]
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 . /etc/apt/sources.list
- B . /etc/apt/listchanges.conf
- C . /etc/yum/yum.conf
- D . /etc/dnf/dnf.conf
A systems administrator wants to test the route between IP address 10.0.2.15 and IP address 192.168.1.40.
Which of the following commands will accomplish this task?
- A . route -e get to 192.168.1.40 from 10.0.2.15
- B . ip route get 192.163.1.40 from 10.0.2.15
- C . ip route 192.169.1.40 to 10.0.2.15
- D . route -n 192.168.1.40 from 10.0.2.15
B
Explanation:
The command ip route get 192.168.1.40 from 10.0.2.15 will test the route between the IP address 10.0.2.15 and the IP address 192.168.1.40. The ip route get command shows the routing decision for a given destination and source address. This is the correct command to accomplish the task. The other options are incorrect because they either use the wrong commands (route instead of ip route), the wrong options (-e or -n instead of get), or the wrong syntax (to instead of from).
Reference: CompTIA Linux+ (XK0-005) Certification Study Guide, Chapter 12: Managing Network Connections, page 379.
A user created the following script file:
# ! /bin/bash
# FILENAME: /home/user/ script. sh echo "hello world"
exit 1
However, when the user tried to run the script file using the command "script. sh, an error returned indicating permission was denied.
Which of the follow-ing should the user execute in order for the script to run properly?
- A . chmod u+x /home/user/script. sh
- B . chmod 600 /home/user/script. sh
- C . chmod /home/user/script. sh
- D . chmod 0+r /horne/user/script. sh
A
Explanation:
To run a script file, the user needs to have execute permission on the file. The command chmod u+x /home/user/script.sh (A) will grant execute permission to the owner of the file, which is the user who created it. The other commands will not give execute permission to the user, and therefore will not allow the script to run properly.
Reference: [CompTIA Linux+ Study Guide], Chapter 3: Working with Files, Section: Changing File Permissions [How to Make a Bash Script Executable]
A Linux administrator needs to create a symlink for /usr/local/bin/app-a, which was installed in /usr/local/share/app-a.
Which of the following commands should the administrator use?
- A . In -s /usr/local/bin/app-a /usr/local/share/app-a
- B . mv -f /usr/local/share/app-a /usr/local/bin/app-a
- C . cp -f /usr/local/share/app-a /usr/local/bin/app-a
- D . rsync -a /usr/local/share/app-a /usr/local/bin/app-a
A
Explanation:
To create a symlink for /usr/local/bin/app-a, which was installed in /usr/local/share/app-a, the administrator can use the command ln -s /usr/local/share/app-a /usr/local/bin/app-a (A). This will create a symbolic link named /usr/local/bin/app-a that points to the original file /usr/local/share/app-a. The other commands will not create a symlink, but either move, copy, or synchronize the file.
Reference: [CompTIA Linux+ Study Guide], Chapter 3: Working with Files, Section: Creating Links [How to Create Symbolic Links in Linux]