Practice Free XK0-005 Exam Online Questions
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 . systemctl enable
- B . [Option missing]
- C . systemctl daemon-reload
- D . systemctl restart
C
Explanation:
Comprehensive and Detailed Step-by-Step
When 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.
Reference: CompTIA Linux+ Official Study Guide, Chapter on Systemd and Service Management
A Linux administrator is trying to remove the ACL from the file /home/user/data. txt but receives the following error message:
Given the following analysis:
Which of the following is causing the error message?
- A . The administrator is not using a highly privileged account.
- B . The filesystem is mounted with the wrong options.
- C . SELinux file context is denying the ACL changes.
- D . File attributes are preventing file modification.
D
Explanation:
File attributes are preventing file modification, which is causing the error message. The output of lsattr /home/user/data.txt shows that the file has the immutable attribute (i) set, which means that the file cannot be changed, deleted, or renamed. The command setfacl -b /home/user/data.txt tries to remove the ACL from the file, but fails because of the immutable attribute. The administrator needs to remove the immutable attribute first by using the command chattr -i /home/user/data.txt and then try to remove the ACL again. The other options are incorrect because they are not supported by the outputs. The administrator is using a highly privileged account, as shown by the # prompt. The filesystem is mounted with the correct options, as shown by the output of mount | grep /home. SELinux file context is not denying the ACL changes, as shown by the output of ls -Z /home/user/data.txt.
Reference: CompTIA Linux+ (XK0-005) Certification
Study Guide, Chapter 11: Managing Files and Directories, pages 357-358.
A Linux systems administrator wants to validate the network interfaces configuration and status on a Linux server.
Which of the following commands should the administrator use to display the information for interface eth3 including status, IP address, subnet mask, and configuration?
- A . ip list interface eth3
- B . ip addr show dev eth3
- C . ip show eth3
- D . ip config eth3
A systems administrator is customizing a new Linux server.
Which of the following settings for umask would ensure that new files have the default permissions of -rw-r–r–?
- A . 0017
- B . 0027
- C . 0038
- D . 0640
B
Explanation:
The umask determines the default permission for new files. To get -rw-r–r– (644), the umask should be set to 0027. This sets the permissions to allow read and write for the owner, read-only for the group, and no permissions for others.
A Linux engineer receives the following notification from a system:
cp: cannot create regular file ‘/app/appdata.tar*’: No space left on device
The engineer obtains the following output:
Which of the following describes the state of the filesystem based on this output?
- A . The filesystem was mounted in read-only mode.
- B . The filesystem has depleted the available inodes.
- C . The filesystem is not mounted in the correct location.
- D . The filesystem has consumed the available space.
B
Explanation:
The error "No space left on device" usually means either disk space or inodes are exhausted. Checking the disk space (df -h), we see only 6.1MB is used, meaning there is plenty of free space (1.9GB available).
Checking inodes (df -i), we see all 2048 inodes are used (IUsed = 2048, IFree = 0), meaning no new files can be created even though space is available.
Inodes are metadata structures used to track files. Small files or a large number of directories can exhaust inodes before disk space runs out.
Fixing the Issue:
Remove unnecessary small files to free inodes:
find /app -type f -exec rm -f {} +
Recreate the filesystem with a higher inode count:
bash
CopyEdit
mkfs.ext4 -N 500000 /dev/vdb
Reference: Filesystem Inodes C Linux Documentation
A new file was added to a main Git repository. An administrator wants to synchronize a local copy with the contents of the main repository.
Which of the following commands should the administrator use for this task?
- A . git reflog
- B . git pull
- C . git status
- D . git push
B
Explanation:
The 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).
Reference: CompTIA Linux+ (XK0-005) Certification Study Guide, Chapter 12: Managing Network Connections, page 381.
A systems administrator identifies multiple processes in a zombie state.
Which of the following signals would be best for the administrator to send to the PPID?
- A . SIGTERM
- B . SIGHUP
- C . SIGQUIT
- D . SIGSTOP
A
Explanation:
A zombie process is a process that has completed execution but still has an entry in the process table because its parent process has not read its exit status. The best signal to send to the parent process is SIGTERM, which politely asks it to terminate and release the resources held by the zombie child processes.
Which of the following paths stores the configuration files in a Linux filesystem?
- A . /proc
- B . /home
- C . /root
- D . /etc
D
Explanation:
The /etc directory contains configuration files for system-wide settings and services in Linux. Files like /etc/fstab, /etc/hosts, and /etc/passwd reside here, controlling various aspects of system behavior and service configurations.
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.
B
Explanation:
The 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
Why the other options are incorrect?
A Linux administrator needs to restart a server and wants to see if any users are currently connected to it.
Which of the following commands should the administrator run to find this information?
- A . man
- B . id
- C . w
- D . host