Practice Free XK0-005 Exam Online Questions
A Linux administrator is troubleshooting a memory-related issue.
Based on the output of the commands:
Which of the following commands would address the issue?
- A . top -p 8321
- B . kill -9 8321
- C . renice -10 8321
- D . free 8321
B
Explanation:
The 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.
Reference: How to troubleshoot Linux server memory issues; kill(1) – Linux manual page
A Linux administrator is troubleshooting a memory-related issue.
Based on the output of the commands:
Which of the following commands would address the issue?
- A . top -p 8321
- B . kill -9 8321
- C . renice -10 8321
- D . free 8321
B
Explanation:
The 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.
Reference: How to troubleshoot Linux server memory issues; kill(1) – Linux manual page
Users report that connections to a MariaDB service are being closed unexpectedly.
A systems administrator troubleshoots the issue and finds the following message in /var/log/messages:
Which of the following is causing the connection issue?
- A . The process mysqld is using too many semaphores.
- B . The server is running out of file descriptors.
- C . Something is starving the server resources.
- D . The amount of RAM allocated to the server is too high.
B
Explanation:
The message in /var/log/messages indicates that the server is running out of file descriptors. A file descriptor is a non-negative integer identifier for an open file in Linux. Each process has a table of open file descriptors where a new entry is appended upon opening a new file. There is a limit on how many file descriptors a process can open at a time, which depends on the system configuration and the user privileges. If a process tries to open more files than the limit, it will fail with an error message like "Too many open files". This could cause connections to be closed unexpectedly or other problems with the application.
The other options are not correct causes for the connection issue. The process mysqld is not using too many semaphores, which are synchronization mechanisms for processes that share resources. Semaphores are not related to file descriptors or open files. Something is not starving the server resources, which could mean high CPU usage, memory pressure, disk I/O, network congestion, or other factors that affect performance. These could cause slowdowns or timeouts, but not file descriptor exhaustion. The amount of RAM allocated to the server is not too high, which could cause swapping or paging if it exceeds the physical memory available. This could also affect performance, but not file descriptor availability.
Reference: File Descriptor Requirements (Linux Systems); Limits on the Number of Linux File Descriptors
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 . Puppet
- B . Git
- C . Ansible
- D . Terraform
D
Explanation:
The 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).
Reference: CompTIA Linux+ (XK0-005) Certification Study Guide, Chapter 19: Managing Cloud and Virtualization Technologies, page 559.
A Linux system is having issues. Given the following outputs:
# dig @192.168.2.2 mycomptiahost
; << >> DiG 9.9.4-RedHat-9.9.4-74.el7_6.1 << >> @192.168.2.2 mycomptiahost
; (1 server found)
;; global options: +cmd
;; connection timed out; no servers could be reached
# nc -v 192.168.2.2 53
Ncat: Version 7.70 ( https://nmap.org/ncat )
Ncat: Connection timed out.
# ping 192.168.2.2
PING 192.168.2.2 (192.168.2.2) 56(84) bytes of data.
64 bytes from 192.168.2.2: icmp_seq=1 ttl=117 time=4.94 ms
64 bytes from 192.168.2.2: icmp_seq=2 ttl=117 time=10.5 ms
Which of the following best describes this issue?
- A . The DNS host is down.
- B . The name mycomptiahost does not exist in the DNS.
- C . The Linux engineer is using the wrong DNS port.
- D . The DNS service is currently not available or the corresponding port is blocked.
D
Explanation:
The ping command shows that the Linux system can reach the DNS server at 192.168.2.2, so the DNS host is not down. The dig and nc commands show that the Linux system cannot connect to the DNS server on port 53, which is the standard port for DNS queries. This means that either the DNS service is not running on the DNS server, or there is a firewall or network device blocking the port 53 traffic. Therefore, the DNS service is currently not available or the corresponding port is blocked.
Reference
1: How To Troubleshoot DNS Client Issues in Linux C RootUsers
2: 6 Best Tools to Troubleshoot DNS Issues in Linux C Tecmint
3: How To Troubleshoot DNS in Linux – OrcaCore4: Fixing DNS Issues in Ubuntu 20.04 | DeviceTests
A systems administrator wants to delete app. conf from a Git repository.
Which of the following commands will delete the file?
- A . git tag app. conf
- B . git commit app. conf
- C . git checkout app. conf
- D . git rm app. conf
D
Explanation:
To delete a file from a Git repository, the administrator can use the command git rm app.conf (D). This will remove the file “app.conf” from the working directory and stage it for deletion from the repository. The administrator can then commit the change with git commit -m "Delete app.conf" to finalize the deletion. The other commands will not delete the file, but either tag, commit, or checkout the file.
Reference: [CompTIA Linux+ Study Guide], Chapter 10: Working with Git, Section: Deleting Files with Git [How to Delete Files from Git]
An administrator is troubleshooting a database service outage that was reported by a monitoring
system.
Given the following output:
$ systemctl status mariadb
Oct 20 16:40:45 comptia systemd[1]: mariadb.service: Main process exited, code=killed, status=9/KILL
Oct 20 16:40:45 comptia systemd[1]: mariadb.service: Failed with result ‘signal’.
Oct 20 16:40:50 comptia systemd[1]: Stopped MariaDB 10.3 database server.
$ dmesg
[ 1061.491433] oom-
kill:constraint=CONSTRAINT_NONE,nodemask=(null),cpuset=/,mems_allowed=0,global_oom, task_memcg=/system.slice/mariadb.service, task=mysqld,pid=1981,uid=27
[ 1061.491453] Out of memory: Killed process 1981 (mysqld) total-vm:330668kB, anon-rss:31316kB, file-rss:OkB, shmem-rss:OkB, UID:27 pgtables:324kB oom_score_adj:0
Which of the following is the reason for the outage?
- A . The administrator sent a kill signal to the database
- B . The server is missing the DMA bus
- C . The database cannot write anything else to the storage
- D . The server does not have enough physical memory
D
Explanation:
The oom-killer was invoked because the system ran out of memory, and as a result, it killed the mysqld process to free memory. This is a clear indication that the server did not have enough physical memory to run the MariaDB service, leading to the process being terminated.
A Linux administrator is troubleshooting an issue in which users are not able to access https://portal.comptia.org from a specific workstation.
The administrator runs a few commands and receives the following output:
Which of the following tasks should the administrator perform to resolve this issue?
- A . Update the name server in resolv. conf to use an external DNS server.
- B . Remove the entry for portal. comptia.org from the local hosts file.
- C . Add a network route from the 10.10.10.0/24 to the 192.168.0.0/16.
- D . Clear the local DNS cache on the workstation and rerun the host command.
B
Explanation:
The best task to perform to resolve this issue is B. Remove the entry for portal.comptia.org from the local hosts file. This is because the local hosts file has a wrong entry that maps portal.comptia.org to 10.10.10.55, which is different from the actual IP address of 192.168.1.55 that is returned by the DNS server. This causes a mismatch and prevents the workstation from accessing the website. By removing or correcting the entry in the hosts file, the workstation will use the DNS server to resolve the domain name and access the website successfully.
To remove or edit the entry in the hosts file, you need to have root privileges and use a text editor such as vi or nano.
For example, you can run the command: sudo vi /etc/hosts
and delete or modify the line that says:
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 . ssh-copy-id
- B . ssh-agent
- C . ssh-add
- D . ssh-keygen
A Linux administrator provisioned a new web server with custom administrative permissions for certain users. The administrator receives a report that user1 is unable to restart the Apache web service on this server. The administrator reviews the following output: [ root@server ] # id user1
UID=1011 (user1) gid=1011 (USER1) groups=1011 (user1), 101 (www-data), 1120 (webadmin) [ root@server ] # cat /etc/sudoers.d/custom.conf
user1 ALL=/usr/sbin/systemctl start httpd, /usr/sbin/systemctl stop httpd
webadmin ALL=NOPASSWD: /etc/init.d.httpd restart, /sbin/service httpd restart,
/usr/sbin/apache2ctl restart
#%wheel ALL=(ALL) NOPASSWD: ALL
Which of the following would most likely resolve the issue while maintaining a least privilege security model?
- A . User1 should be added to the wheel group to manage the service.
- B . User1 should have "NOPASSWD:" after the "ALL=" in the custom. conf.
- C . The wheel line in the custom. conf file should be uncommented.
- D . Webadmin should be listed as a group in the custom. conf file.
D
Explanation:
The custom.conf file grants sudo privileges to user1 and webadmin for managing the Apache web service, but it uses different commands for each of them. User1 is allowed to use systemctl to start and stop the httpd service, while webadmin is allowed to use init.d, service, or apache2ctl to restart the httpd service. However, the user1 is unable to restart the service, only start and stop it. To fix this, user1 should be able to use the same commands as webadmin, which can be achieved by listing webadmin as a group in the custom.conf file, using the syntax %groupname. This way, user1 will inherit the sudo privileges of the webadmin group, and be able to restart the Apache web service without compromising the least privilege security model.
Reference
Sudo and Sudoers Configuration | Servers for Hackers, section “Groups”
Chapter 12. Managing sudo access – Red Hat Customer Portal, section “12.1. Configuring sudo access for users and groups”