Practice Free XK0-005 Exam Online Questions
A Linux engineer is setting the sticky bit on a directory called devops with 755 file permission.
Which of the following commands will accomplish this task?
- A . chown -s 755 devops
- B . chown 1755 devops
- C . chmod -s 755 devops
- D . chmod 1755 devops
D
Explanation:
The command that will set the sticky bit on a directory called devops with 755 file permission is chmod 1755 devops. This command will use chmod to change the mode of the directory devops to 1755, 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). The first digit 1 indicates that the sticky bit is set on the directory, which is a special permission that prevents users from deleting or renaming files in the directory that they do not own.
The other options are not correct commands for setting the sticky bit on a directory. The chown -s 755 devops command is invalid because chown is used to change the owner and group of files or directories, not their permissions. The -s option for chown is used to remove a symbolic link, not to set the sticky bit. The chown 1755 devops command is also invalid because chown does not accept numeric arguments for changing permissions. The chmod -s 755 devops command will remove the sticky bit from the directory devops, not set it. : chmod(1) – Linux manual page; How to Use SUID, SGID, and Sticky Bits on Linux
A Linux systems administrator needs to add additional code to code that resides within a repository without changing the original code. Once completed, the additional code will be merged into the main branch.
Which of the following commands should the administrator use first?
- A . git push
- B . git rebase
- C . git tag
- D . git clone
A systems administrator was tasked with assigning the temporary IP address/netmask 192.168.168.1/255.255.255.255 to the interface eth0 of a Linux server.
When adding the address, the following error appears:
# ip address add 192.168.168.1/33 dev eth0
Error: any valid prefix is expected rather than "192.168.168.1/33".
Based on the command and its output above, which of the following is the cause of the issue?
- A . The CIDR value /33 should be /32 instead.
- B . There is no route to 192.168.168.1/33.
- C . The interface eth0 does not exist.
- D . The IP address 192.168.168.1 is already in use.
A
Explanation:
The cause of the issue is that the CIDR value /33 is invalid for an IPv4 address. The CIDR value represents the number of bits in the network prefix of an IP address, and it can range from 0 to 32 for IPv4 addresses. A CIDR value of /33 would imply a network prefix of more than 32 bits, which is impossible for an IPv4 address. To assign a temporary IP address/netmask of 192.168.168.1/255.255.255.255 to eth0, the CIDR value should be /32 instead, which means a network prefix of 32 bits and a host prefix of 0 bits. There is no route to 192.168.168.1/33 is not the cause of the issue, as the ip address add command does not check the routing table. The interface eth0 does not exist is not the cause of the issue, as the ip address add command would display a different error message if the interface does not exist. The IP address 192.168.168.1 is already in use is not the cause of the issue, as the ip address add command would display a different error message if the IP address is already in use. [CompTIA Linux+ (XK0-005) Certification Study Guide], Chapter 13: Networking Fundamentals, page 435.
A systems administrator needs to reconfigure a Linux server to allow persistent IPv4 packet forwarding.
Which of the following commands is the correct way to accomplish this task?
- A . echo 1 > /proc/sys/net/ipv4/ipv_forward
- B . sysctl -w net.ipv4.ip_forward=1
- C . firewall-cmd –enable ipv4_forwarding
- D . systemct1 start ipv4_forwarding
B
Explanation:
The command sysctl -w net.ipv4.ip_forward=1 enables IPv4 packet forwarding temporarily by setting the kernel parameter net.ipv4.ip_forward to 1. To make this change persistent, the administrator needs to edit the file /etc/sysctl.conf and add the line net.ipv4.ip_forward = 1. The other options are incorrect because they either use the wrong file (/proc/sys/net/ipv4/ipv_forward), the wrong command (firewall-cmd or systemct1), or the wrong option (–enable or start). CompTIA Linux+ (XK0-005) Certification Study Guide, Chapter 12: Managing Network Connections, page 378.
An administrator has source code and needs to rebuild a kernel module.
Which of the following command sequences is most commonly used to rebuild this type of module?
- A . ./configuremakemake install
- B . wgetgcccp
- C . tar xvzfbuildcp
- D . buildinstallconfigure
A
Explanation:
The best command sequence to rebuild a kernel module from source code is
A newly hired Linux administrator needs to grant access to the Linux servers by generating a password-protected RSA key of 4096 bytes.
Which of the following commands will accomplish this task?
- A . ssh-keygen -RPb 4096
- B . ssh-keygen -t rsa -b 4096
- C . ssh-keygen -k rsa -l 4096 -p
- D . ssh-keygen -t dsa -B 4096
B
Explanation:
The correct command to generate a 4096-bit RSA key is:
bash
ssh-keygen -t rsa -b 4096
This command:
-t rsa: Specifies RSA key type
-b 4096: Specifies key size in bits
During the prompt, the user will be asked if they want to set a passphrase (password), fulfilling the password protection requirement.
Option A has invalid flags (-RPb).
Option C uses incorrect and non-existent flags (-k, -l, -p in this context).
Option D incorrectly uses DSA (which is deprecated and does not support 4096 bits).
Reference: CompTIA Linux+ XK0-005 Official Study Guide, Domain 3.2 C Implement identity and access management:
“Use ssh-keygen -t rsa -b 4096 to generate a secure RSA key. When prompted, set a passphrase for password protection.”
An administrator completes maintenance on a server but cannot remount the logical volume.
Given the following output:
# mount /dev/data/files /opt/data/
mount: /opt/data: special device /dev/data/files does not exist.
# lvs
LV VG Attr LSize Pool Origin Data% Meta% Move Log Cpy%Sync Convert
files data -wi-a—— 600.00m
# vgs
VG #PV #LV #SN Attr VSize VFree
data 1 1 0 wz―n- 1020.00m 420.00m
Which of the following commands should the administrator execute to resolve the issue?
- A . vgchange -ay data
- B . lvscan –all
- C . vgimport data
- D . lvchange -ay /dev/data/files
A
Explanation:
The error message indicates that the logical volume is inactive. To activate the volume group, vgchange -ay data is required.
Option A (Correct): This command activates all logical volumes in the volume group data.
Option B: Scans logical volumes but does not activate them.
Option C: vgimport is used for importing volume groups from another system, which is not the issue here.
Option D: lvchange -ay is used for activating specific logical volumes, but the volume group must be activated first.
Reference: CompTIA Linux+ XK0-005 Official Guide C Chapter on LVM Management.
A systems administrator receives the following errors via email from the system log:
go
XFS (loop0): Metadata CRC error detected at xfs_agi_read_verify+0xcb/0xfe
XFS (loop0): First 128 bytes of corrupted metadata buffer
XFS (loop0): metadata I/O error in "xfs_trans_read_buf_map" at daddr 0x2 len 1 error 74
A few minutes later, the administrator starts receiving reports that some of the images in the company’s website are not loading properly.
The systems administrator runs some commands and receives the following outputs:
css
Output 1
NAME FSTYPE UUID MOUNTPOINT
sda ext4 02ae47-fe457-45bc /
sdb xfs 347c7056 /var/www/html
Output 2
DocumentRoot "/var/www/html"
Output 3
httpd.service – The Apache HTTP Server
Loaded: loaded (/usr/lib/systemd/system/httpd.service; enabled; vendor preset: disabled)
Active: active (running) since Sun 1991-05-24 16:12:43 UTC; 30y ago
Main PID: 252 (httpd)
Which of the following would be the appropriate steps to take to solve this issue?
- A . systemctl stop httpd umount /dev/sdb1 xfs_repair /dev/sdb1 mount /dev/sdb1 /var/www/html systemctl start httpd
- B . umount /dev/sdb1 xfs_repair /dev/sdb1 xfs_metadump /dev/sdb1 mount /dev/sdb1 /var/www/html systemctl restart httpd
- C . umount /dev/sdb1 systemctl stop httpd xfs_metadump /dev/sdb1 mount /dev/sdb1 /var/www/html systemctl start httpd
- D . systemctl stop httpd xfs_check -L /dev/sdb umount /var/www/html systemctl start httpd
A
Explanation:
The error is related to XFS filesystem corruption on /dev/sdb1, where the website’s images are stored. By stopping the Apache service, unmounting the filesystem, running xfs_repair, and remounting, the filesystem can be repaired, and the service can be restarted safely.
Which of the following are valid reasons for a Linux server to perform slower than expected? (Choose two)
- A . High swap usage
- B . Insufficient file permissions
- C . Network misconfiguration
- D . Full disk usage
An administrator made a change to a system’s network configuration.
Which of the following best represents what the administrator should do to have the new configuration take effect?
- A . systemctl restart networkd
- B . systemctl enable networkd
- C . systemctl status networkd
- D . systemctl isolate networkd
A
Explanation:
The command systemctl restart networkd is used to apply new network configurations by restarting the network service. This ensures that any changes made to network settings (such as IP addresses, routes, or DNS settings) take effect without requiring a system reboot.