Practice Free XK0-005 Exam Online Questions
A Linux administrator rebooted a server. Users then reported some of their files were missing. After doing some troubleshooting, the administrator found one of the filesystems was missing. The filesystem was not listed in /etc/f stab and might have been mounted manually by someone prior to reboot.
Which of the following would prevent this issue from reoccurring in the future?
- A . Sync the mount units.
- B . Mount the filesystem manually.
- C . Create a mount unit and enable it to be started at boot.
- D . Remount all the missing filesystems
C
Explanation:
The best way to prevent this issue from reoccurring in the future is to create a mount unit and enable it to be started at boot. A mount unit is a systemd unit that defines how and where a filesystem should be mounted. By creating a mount unit for the missing filesystem and enabling it with systemct1 enable, the administrator can ensure that the filesystem will be automatically mounted at boot time, regardless of whether it is listed in /etc/fstab or not. Syncing the mount units will not prevent the issue, as it will only synchronize the state of existing mount units with /etc/fstab, not create new ones. Mounting the filesystem manually will not prevent the issue, as it will only mount the filesystem temporarily, not permanently. Remounting all the missing filesystems will not prevent the issue, as it will only mount the filesystems until the next reboot, not after.
Reference: CompTIA Linux+ (XK0-005) Certification Study Guide, Chapter 14: Managing Disk Storage, page 457.
A systems administrator created a new directory with specific permissions.
Given the following output:
# file: comptia
# owner: root
# group: root user: : rwx group :: r-x other: :—
default:user :: rwx
default:group :: r-x
default:group:wheel: rwx
default:mask :: rwx
default:other ::-
Which of the following permissions are enforced on /comptia?
- A . Members of the wheel group can read files in /comptia.
- B . Newly created files in /comptia will have the sticky bit set.
- C . Other users can create files in /comptia.
- D . Only root can create files in /comptia.
A
Explanation:
The output shows the file access control list (FACL) of the /comptia directory, which is an extension of the standard Linux permissions that allows more fine-grained control over file and directory access1. The FACL consists of two parts: the access ACL and the default ACL. The access ACL applies to the current object, while the default ACL applies to the objects created within the directory2.
The access ACL has three entries: user, group, and other. These are similar to the standard Linux permissions, but they can be specified for individual users or groups as well. The user entry shows that the owner of the directory (root) has read, write, and execute permissions (rwx). The group entry shows that the group owner of the directory (root) has read and execute permissions (r-x). The other entry shows that all other users have no permissions (―).
The default ACL has five entries: user, group, group:wheel, mask, and other. These are applied to any files or directories created within /comptia. The user entry shows that the owner of the new object will have read, write, and execute permissions (rwx). The group entry shows that the group owner of the new object will have read and execute permissions (r-x). The group:wheel entry shows that the members of the wheel group will have read, write, and execute permissions (rwx) on the new object. The mask entry shows that the maximum permissions allowed for any user or group are read, write, and execute (rwx). The other entry shows that all other users will have no permissions (―) on the new object.
Therefore, based on the FACL output, members of the wheel group can read files in /comptia, as they have read permission on both the directory and any files within it.
Option B is incorrect because the sticky bit is not set on /comptia or any files within it. The sticky bit is a special permission that prevents users from deleting or renaming files that they do not own in a shared directory3. It is symbolized by a t character in the execute position of others.
Option C is incorrect because other users cannot create files in /comptia, as they have no permissions on the directory or any files within it.
Option D is incorrect because root is not the only user who can create files in /comptia. Any user who has write permission on the directory can create files within it, such as members of the wheel group.
A Linux administrator was tasked with deleting all files and directories with names that are contained in the sobelete.txt file.
Which of the following commands will accomplish this task?
- A . xargs -f cat toDelete.txt -rm
- B . rm -d -r -f toDelete.txt
- C . cat toDelete.txt | rm -frd
- D . cat toDelete.txt | xargs rm -rf
D
Explanation:
The command cat toDelete.txt | xargs rm -rf will delete all files and directories with names that are contained in the toDelete.txt file. The cat command reads the file and outputs its contents to the standard output. The | operator pipes the output to the next command. The xargs command converts the output into arguments for the next command. The rm -rf command removes the files and directories recursively and forcefully. This is the correct way to accomplish the task. The other options are incorrect because they either use the wrong options (-f instead of -a for xargs), the wrong arguments (toDelete.txt instead of toDelete.txt filename for rm), or the wrong commands (rm instead of xargs).
Reference: CompTIA Linux+ (XK0-005) Certification Study Guide, Chapter 11:
Managing Files and Directories, pages 349-350.
An organization’s business office needs to collaborate on quarterly reports and asks the systems administrator to create a finance group. The administrator creates the following directory: drwxrwxr-x Business Business |j096 Oct 15 16:40 Q1
Which of the following commands will allow all members of the finance group to have group ownership of all files created in the Q1 directory while ensuring that members of the business group preserve access? (Select two).
- A . chmod g+s Q1/
- B . chmod u+s Q1/
- C . chmod a+x Q1/
- D . chown Finance Q1/
- E . chmod g+x Q1/
A,D
Explanation:
To ensure all files created in Q1 inherit the group ownership of finance, the chmod g+s command sets the group ID (SGID) on the directory, ensuring new files belong to the group of the directory. chown Finance Q1/ changes the group ownership of Q1 to Finance, allowing Finance group members access. These settings facilitate collaborative permissions as per CompTIA Linux+ recommendations for group-based file sharing.
Reference: CompTIA Linux+ Study Guide.
An organization’s business office needs to collaborate on quarterly reports and asks the systems administrator to create a finance group. The administrator creates the following directory: drwxrwxr-x Business Business |j096 Oct 15 16:40 Q1
Which of the following commands will allow all members of the finance group to have group ownership of all files created in the Q1 directory while ensuring that members of the business group preserve access? (Select two).
- A . chmod g+s Q1/
- B . chmod u+s Q1/
- C . chmod a+x Q1/
- D . chown Finance Q1/
- E . chmod g+x Q1/
A,D
Explanation:
To ensure all files created in Q1 inherit the group ownership of finance, the chmod g+s command sets the group ID (SGID) on the directory, ensuring new files belong to the group of the directory. chown Finance Q1/ changes the group ownership of Q1 to Finance, allowing Finance group members access. These settings facilitate collaborative permissions as per CompTIA Linux+ recommendations for group-based file sharing.
Reference: CompTIA Linux+ Study Guide.
Users have been unable to save documents to /home/tmp/temp and have been receiving the following error:
Path not found
A junior technician checks the locations and sees that /home/tmp/tempa was accidentally created instead of /home/tmp/temp.
Which of the following commands should the technician use to fix this issue?
- A . cp /home/tmp/tempa /home/tmp/temp
- B . mv /home/tmp/tempa /home/tmp/temp
- C . cd /temp/tmp/tempa
- D . ls /home/tmp/tempa
B
Explanation:
The mv /home/tmp/tempa /home/tmp/temp command will fix the issue of the misnamed directory. This command will rename the directory /home/tmp/tempa to /home/tmp/temp, which is the expected path for users to save their documents. The cp /home/tmp/tempa /home/tmp/temp command will not fix the issue, as it will copy the contents of /home/tmp/tempa to a new file named /home/tmp/temp, not a directory. The cd /temp/tmp/tempa command will not fix the issue, as it will change the current working directory to /temp/tmp/tempa, which does not exist. The ls /home/tmp/tempa command will not fix the issue, as it will list the contents of /home/tmp/tempa, not rename it.
Reference: CompTIA Linux+ (XK0-005) Certification Study Guide, Chapter 12: Managing Files and Directories, page 413.
A Linux administrator modified the SSH configuration file.
Which of the following commands should be used to apply the configuration changes?
- A . systemct1 stop sshd
- B . systemct1 mask sshd
- C . systemct1 reload sshd
- D . systemct1 start sshd
C
Explanation:
The systemct1 reload sshd command can be used to apply the configuration changes of the SSH server daemon without restarting it. This is useful to avoid interrupting existing connections. The systemct1 stop sshd command would stop the SSH server daemon, not apply the changes. The systemct1 mask sshd command would prevent the SSH server daemon from being started, not apply the changes. The systemct1 start sshd command would start the SSH server daemon if it is not running, but it would not apply the changes if it is already running.
Reference: CompTIA Linux+ (XK0-005) Certification Study Guide, Chapter 12: Secure Shell (SSH), page 415.
A diagnostic tool reports a "host seems down" event for a server with an IP address of 192.168.47.44.
Which of the following commands should the administrator use to confirm the host down event?
- A . nmap 192.168.47.0/32
- B . netcat 192.168.47.44
- C . nmap 192.168.47.44 -Pn
- D . ping -c 1 192.168.47.44
D
Explanation:
The ping -c 1 192.168.47.44 command sends one ICMP echo request to the specified host to check its availability. If the host is down, there will be no response. This is the quickest way to confirm if a host is reachable. nmap -Pn can also be used to check a host status, but ping is faster and lighter.
18.99.101 www.comptia.org
Which of the following is the most likely cause?
- A . The static entry needs to be removed from /etc/hosts.
- B . The remote website does not support IPv6, and the workstation requires it.
- C . The firewall needs to be modified to allow outbound HTTP and HTTPS.
- D . The nameserver in /etc/resolv.conf needs to be updated to 8.8.8.8.
A
Explanation:
The presence of a static entry in /etc/hosts for www.comptia.org forces the system to use this IP address instead of querying DNS.
This prevents proper IPv6 (AAAA) resolution, as /etc/hosts only contains an IPv4 (A) record. Removing this static entry allows the system to query DNS for both IPv4 and IPv6 records.
Reference: Linux /etc/hosts File C Linux Documentation
A developer wants to ensure that all files and folders created inside a shared folder named /GroupOODEV inherit the group name of the parent folder.
Which of the following commands will help achieve this goal?
- A . chmod g+X / GroupOODEV/
- B . chmod g+W / GroupOODEV/
- C . chmod g+r / GroupOODEV/
- D . chmod g+s / GroupOODEV/
D
Explanation:
The chmod command is used to change the permissions of files and directories on Linux systems. The g+s option sets the setgid bit on a directory, which means that all files and folders created inside that directory will inherit the group name of the parent directory. This command can help the developer ensure that all files and folders created inside the /GroupOODEV directory have the same group name as /GroupOODEV.
Reference: [How to Use chmod Command in Linux with Examples]