Practice Free XK0-005 Exam Online Questions
A DevOps engineer is working on a local copy of a Git repository. The engineer would like to switch from the main branch to the staging branch but notices the staging branch does not exist.
Which of the following Git commands should the engineer use to perform this task?
- A . git branch ―m staging
- B . git commit ―m staging
- C . git status ―b staging
- D . git checkout ―b staging
D
Explanation:
The correct answer is D. git checkout -b staging
This command will create a new branch named staging and switch to it. The git checkout command is used to switch between branches or restore files from a specific branch. The -b option is used to create a new branch if it does not exist. For example, git checkout -b staging will create and switch to the staging branch.
The other options are incorrect because:
A Linux administrator needs to harden a system and guarantee that the Postfix service will not run, even after a restart or system upgrade.
Which of the following commands allows the administrator to fulfill the requirement?
- A . systemctl mask postfix.service
- B . systemctl disable postfix.service
- C . systemctl stop postfix.service
- D . systemctl -n restart postfix.service
A
Explanation:
The systemctl mask postfix.service command prevents the Postfix service from being started manually or automatically by symlinking its service file to /dev/null. This ensures that even if a system restart or upgrade occurs, the service will remain disabled and will not start.
A systems administrator is tasked with installing GRUB on the legacy MBR of the SATA hard drive.
Which of the following commands will help the administrator accomplish this task?
- A . grub-install /dev/hda
- B . grub-install /dev/sda
- C . grub-install /dev/sr0
- D . grub-install /dev/hd0,0
B
Explanation:
The command that will help the administrator install GRUB on the legacy MBR of the SATA hard drive is grub-install /dev/sda. This command will install GRUB on the master boot record (MBR) of the first SATA disk (/dev/sda). The MBR is the first sector of a disk that contains boot code and a partition table. GRUB will overwrite the boot code and place its own code that can load GRUB modules and configuration files from a specific partition.
The other options are not correct commands for installing GRUB on the legacy MBR of the SATA hard drive. The grub-install /dev/hda command will try to install GRUB on the first IDE disk (/dev/hda), which may not exist or may not be bootable. The grub-install /dev/sr0 command will try to install GRUB on the first SCSI CD-ROM device (/dev/sr0), which is not a hard drive and may not be bootable. The grub-install /dev/hd0,0 command is invalid because grub-install does not accept partition names as arguments, only disk names.
Reference: Installing GRUB using grub-install; GRUB Manual
Which of the following options represents disk mirroring?
- A . RAID 0
- B . RAID 1
- C . RAID 5
- D . RAID 6
A Linux administrator is configuring a two-node cluster and needs to be able to connect the nodes to each other using SSH keys from the root account.
Which of the following commands will accomplish this task?
- A . [root@nodea ssh ―i ~/. ssh/±d rsa root@nodeb
- B . [root@nodea scp -i. ssh/id rsa root@nodeb
- C . [root@nodea ssh―copy-id ―i .ssh/id rsa root@nodeb
- D . [root@nodea # ssh add -c ~/. ssh/id rsa root@nodeb
- E . [root@nodea # ssh add -c ~/. ssh/id rsa root@nodeb
C
Explanation:
The ssh-copy-id command is used to copy a public SSH key from a local machine to a remote server and add it to the authorized_keys file, which allows passwordless authentication between the machines. The administrator can use this command to copy the root user’s public key from nodea to nodeb, and vice versa, to enable SSH access between the nodes without entering a password every time.
For example: [root@nodea ssh-copy-id -i ~/.ssh/id_rsa root@nodeb]. The ssh command is used to initiate an SSH connection to a remote server, but it does not copy any keys. The scp command is used to copy files securely between machines using SSH, but it does not add any keys to the authorized_keys file. The ssh-add command is used to add private keys to the SSH agent, which manages them for SSH authentication, but it does not copy any keys to a remote server.
A Linux administrator created a virtual clone of a physical server and would like to remove any existing entries related to SSH keys from outside entities on the virtual clone.
Which of the following files should the administrator remove? (Select two).
- A . ~/.ssh/authorized_keys
- B . ~/.ssh/known_hosts
- C . /etc/ssh/ssh_config
- D . ~/.ssh/config
- E . /etc/ssh/sshd_config
- F . /etc/ssh/ssh_host_rsa_key.pub
A,B
Explanation:
The ~/.ssh/authorized_keys file contains SSH public keys that grant access to the user account. Removing this file ensures that no external entities can log in using previously authorized keys. The ~/.ssh/known_hosts file stores fingerprints of previously connected hosts. Removing this file ensures that SSH doesn’t trust any previously connected hosts.
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 security analyst is monitoring the network to identify latency or slowdowns during a vulnerability scan.
Which of the following functions will best achieve this?
bash
function x() {
info=$(ping -c 1 $1 | awk -F "/" ‘END {print $5}’)
echo "$1 | $info"
}
- A . function x() { info=$(dig $(dig -x $1 | grep ptr | tail -n 1 | awk -F ".in-addr" ‘{print $1}’).origin.asn.cymru.com TXT +short); echo "$1 | $info" }
- B . function x() { info=$(ping -c 1 $1 | awk -F "/" ‘END {print $5}’); echo "$1 | $info" }
- C . function x() { info=$(nc -m 40 $1 | awk ‘END {print $1}’); echo "$1 | $info" }
- D . function x() { info=$(geoiplookup $1); echo "$1 | $info" }
B
Explanation:
The ping command is used to measure network latency. The function provided uses ping -c 1 to ping the target once and extracts the average round-trip time using awk. This is a simple and effective way to monitor network latency during a scan or other network activity.
A Linux systems administrator is updating code. After completing the update, the administrator wants to publish the updated code without including the configuration files.
Which of the following should the administrator use to accomplish this task?
- A . git clone
- B . git –
- C . .gitignore
- D . git fetch
C
Explanation:
The .gitignore file is used in Git to specify which files or directories should be ignored in a repository. By listing configuration files in the .gitignore file, the administrator ensures they are not included in any future commits or pushes to the remote repository. This is essential when dealing with sensitive or environment-specific files that should not be shared or deployed.
Reference: Git Documentation on .gitignore
Users have reported that the interactive sessions were lost on a Linux server. A Linux administrator verifies the server was switched to rescue.target mode for maintenance.
Which of the following commands will restore the server to its usual target?
- A . telinit 0
- B . systemct1 reboot
- C . systemct1 get-default
- D . systemct1 emergency
B
Explanation:
The systemct1 reboot command will restore the server to its usual target by rebooting it. This will cause the server to load the default target specified in /etc/systemd/system.conf or /etc/systemd/system/default.target files. The telinit 0 command would shut down the server, not restore it to its usual target. The systemct1 get-default command would display the default target, not change it. The systemct1 emergency command would switch the server to emergency.target mode, which is even more restrictive than rescue.target mode.
Reference: [CompTIA Linux+ (XK0-005) Certification Study Guide], Chapter 17: System Maintenance and Operation, page 516.