Practice Free XK0-005 Exam Online Questions
A non-privileged user is attempting to use commands that require elevated account permissions, but the commands are not successful.
Which of the following most likely needs to be updated?
- A . /etc/passwd
- B . /etc/shadow
- C . /etc/sudoers
- D . /etc/bashrc
C
Explanation:
The /etc/sudoers file is used to configure the sudo command, which allows non-privileged users to execute commands that require elevated account permissions1. The file contains a list of users and groups that are allowed to use sudo, and the commands they can run with it. The file also defines the security policy for sudo, such as whether a password is required, how long the sudo session lasts, and what environment variables are preserved or reset.
The /etc/passwd file is used to store information about the user accounts on the system, such as their username, user ID, home directory, and login shell. The /etc/shadow file is used to store the encrypted passwords for the user accounts, along with other information such as password expiration and aging. These files are not directly related to the sudo command, and updating them will not grant a user elevated account permissions.
The /etc/bashrc file is used to set up the environment for the bash shell, such as aliases, functions, variables, and options. This file is executed whenever a new bash shell is started, and it affects all users on the system. However, this file does not control the sudo command or its configuration, and updating it will not allow a user to use commands that require elevated account permissions.
A systems administrator is receiving complaints about slow performance and system crashes. The administrator suspects memory and CPU issues.
Which of the following is the first action the administrator should take to troubleshoot and resolve these issues?
- A . Run resource monitoring tools like top or htop to view the current CPU and memory use.
- B . Look through the system logs and error messages to find any faults involving the CPU and memory.
- C . Remove and replace the CPU and memory components to address hardware issues.
- D . Reboot the server to clear any CPU and memory congestion.
A
Explanation:
The initial troubleshooting step when experiencing slow performance and potential memory or CPU issues is to analyze the current resource usage. Running tools like top or htop allows the administrator to observe real-time data on CPU, memory, and processes, providing insights into high resource usage. This is a non-invasive first step, helping to identify whether issues are due to overuse, application memory leaks, or specific processes. CompTIA Linux+ recommends understanding system resource behavior before taking further action.
Reference: CompTIA Linux+ Study Guide.
A Linux administrator is troubleshooting an SSHD issue on a server. Users are receiving error messages stating the connection is refused.
Which of the following commands should be used to verify whether the service is listening?
- A . nslookup
- B . route
- C . netstat
- D . ifconfig
C
Explanation:
netstat is a command-line tool that displays network connections, routing tables, and a number of network interface statistics. It can be used to check if the SSHD service is listening on its default port (usually port 22) or any other configured port.
Users report that they cannot access some files located in the /opt/finapp directory after a power outage caused an unexpected server restart.
A Linux administrator examines the following filesystem details and system logs:
# mount | grep finapp
/dev/mapper/rhel-opt_finapp on /opt/finapp type xfs
(rw,relatime,seclabel,attr2,inode64,logbufs=8,logbsize=32k,noquota)
# lsblk
NAME MAJ:MIN RM SIZE RO TYPE MOUNTPOINT
sda 8:0 0 931.5G 0 disk
|-sda1 8:1 0 1G 0 part /boot
|-sda2 8:2 0 930.5G 0 part
|-rhel-root 253:0 0 30.5G 0 lvm /
|-rhel-opt_finapp 253:1 0 900G 0 lvm /opt/finapp
# grep opt_finapp /var/log/messages
XFS (opt_finapp): Corruption detected in inode 3645, extent tree
Which of the following commands should the administrator run in an attempt to fix the filesystem?
- A . fdisk /dev/mapper/rhel-opt_finapp
- B . xfs_repair /dev/mapper/rhel-opt_finapp
- C . lvcreate -L900G -n opt_finapp rhel
- D . fsck.ext4 /dev/mapper/rhel-opt_finapp
B
Explanation:
Step-by-Step Comprehensive Detailed
Command
xfs_repair is the correct tool to repair XFS filesystems. It scans the filesystem metadata for errors and
attempts to fix any corruption.
Why Other Options are Incorrect:
A: fdisk is used to manage partitions, not repair filesystems.
C: lvcreate is for creating logical volumes, not repairing filesystems.
D: fsck.ext4 is used for ext4 filesystems, but /opt/finapp is an XFS filesystem.
Reference: CompTIA Linux+ Guide to Filesystems and Storage man xfs_repair
A user generated a pair of private-public keys on a workstation.
Which of the following commands will allow the user to upload the public key to a remote server and enable passwordless login?
- A . scp ~/.ssh/id_rsa user@server:~/
- B . rsync ~ /.ssh/ user@server:~/
- C . ssh-add user server
- D . ssh-copy-id user@server
D
Explanation:
The command ssh-copy-id user@server will allow the user to upload the public key to a remote server and enable passwordless login. The ssh-copy-id command is a tool for copying the public key to a remote server and appending it to the authorized_keys file, which is used for public key authentication. The command will also set the appropriate permissions on the remote server to ensure the security of the key. The command ssh-copy-id user@server will copy the public key of the user to the server and allow the user to log in without a password. This is the correct command to use for this task. The other options are incorrect because they either do not copy the public key (scp, rsync, or ssh-add) or do not use the correct syntax (scp ~/.ssh/id_rsa user@server:~/ instead of scp ~/.ssh/id_rsa.pub user@server:~/ or rsync ~ /.ssh/ user@server:~/ instead of rsync ~/.ssh/id_rsa.pub user@server:~/).
Reference: CompTIA Linux+ (XK0-005) Certification Study Guide,
Chapter 13: Managing Network Services, page 410.
A systems administrator made some unapproved changes prior to leaving the company. The newly hired administrator has been tasked with revealing the system to a compliant state.
Which of the following commands will list and remove the correspondent packages?
- A . dnf list and dnf remove last
- B . dnf remove and dnf check
- C . dnf info and dnf upgrade
- D . dnf history and dnf history undo last
D
Explanation:
The commands that will list and remove the corresponding packages are dnf history and dnf history undo last. The dnf history command will display a list of all transactions performed by dnf, such as installing, updating, or removing packages. Each transaction has a unique ID, a date and time, an action, and a number of altered packages. The dnf history undo last command will undo the last transaction performed by dnf, meaning that it will reverse all package changes made by that transaction. For example, if the last transaction installed some packages, dnf history undo last will remove them.
The other options are not correct commands for listing and removing corresponding packages. The dnf list command will display a list of available packages in enabled repositories, but not the packages installed by dnf transactions. The dnf remove command will remove specified packages from the system, but not all packages from a specific transaction. The dnf info command will display detailed information about specified packages, but not about dnf transactions. The dnf upgrade command will upgrade all installed packages to their latest versions, but not undo any package changes.
Reference: Handling package management history; dnf(8) – Linux manual page
A systems administrator needs to check the size of the filesystem on the current application servers and ensure that the following filesystems are mounted:
/var
/var/log/audit
/tmp
/home/application
Which of the following commands should the administrator use for these tasks?
- A . fdisk
- B . df
- C . du
- D . lsblk
A Linux systems administrator receives a notification that one of the server’s filesystems is full.
Which of the following commands would help the administrator to identify this filesystem?
- A . lsblk
- B . fdisk
- C . df -h
- D . du -ah
C
Explanation:
The df -h command can be used to identify the filesystem that is full. This command displays the disk usage of each mounted filesystem in a human-readable format, showing the total size, used space, available space, and percentage of each filesystem. The lsblk command displays information about block devices, not filesystems. The fdisk command can be used to manipulate partition tables, not check disk usage. The du -ah command displays the disk usage of each file and directory in a human-readable format, not the filesystems.
Reference: [CompTIA Linux+ (XK0-005) Certification Study Guide], Chapter 14: Managing Disk Storage, page 454.
An administrator needs to stop a foreground process in between its execution in a terminal.
Which of the following should the administrator use?
- A . Ctrl+D
- B . Ctrl+F
- C . Ctrl+Z
- D . Ctrl+C
D
Explanation:
Step-by-Step Comprehensive Detailed
Command
Ctrl+C sends a SIGINT (interrupt signal) to the foreground process, stopping its execution.
Why Other Options are Incorrect:
A: Ctrl+D signals the end-of-file (EOF) in a shell but does not stop processes.
B: Ctrl+F moves the cursor forward but does not affect processes.
C: Ctrl+Z suspends the process (sends it to the background) but does not stop it permanently.
Reference: CompTIA Linux+ Training Materials, Signal Management man signal
A Linux administrator needs to expand a volume group using a new disk.
Which of the following options presents the correct sequence of commands to accomplish the task?
- A . partprobevgcreatelvextend
- B . lvcreatefdiskpartprobe
- C . fdiskpartprobemkfs
- D . fdiskpvcreatevgextend
D
Explanation:
The correct sequence of commands to expand a volume group using a new disk is fdisk, pvcreate, vgextend. The fdisk command can be used to create a partition on the new disk with the type 8e (Linux LVM). The pvcreate command can be used to initialize the partition as a physical volume for LVM. The vgextend command can be used to add the physical volume to an existing volume group. The partprobe command can be used to inform the kernel about partition table changes, but it is not necessary in this case. The vgcreate command can be used to create a new volume group, not expand an existing one. The lvextend command can be used to extend a logical volume, not a volume group. The lvcreate command can be used to create a new logical volume, not expand a volume group. The mkfs command can be used to create a filesystem on a partition or a logical volume, not expand a volume group.
Reference: CompTIA Linux+ (XK0-005) Certification Study Guide, Chapter 14: Managing Disk Storage, pages 462-463.