ExamGecko
Home Home / CompTIA / XK0-005

CompTIA XK0-005 Practice Test - Questions Answers, Page 4

Question list
Search
Search

List of questions

Search

Related questions











A systems administrator created a web server for the company and is required to add a tag for the API so end users can connect. Which of the following would the administrator do to complete this requirement?

A.
hostnamectl status --no-ask-password
A.
hostnamectl status --no-ask-password
Answers
B.
hostnamectl set-hostname "$(perl -le "print" "A" x 86)"
B.
hostnamectl set-hostname "$(perl -le "print" "A" x 86)"
Answers
C.
hostnamectl set-hostname Comptia-WebNode -H [email protected]
C.
hostnamectl set-hostname Comptia-WebNode -H [email protected]
Answers
D.
hostnamectl set-hostname Comptia-WebNode --transient
D.
hostnamectl set-hostname Comptia-WebNode --transient
Answers
Suggested answer: C

Explanation:

The command hostnamectl set-hostname Comptia-WebNode -H [email protected] sets the hostname of the web server to Comptia-WebNode and connects to the server using the SSH protocol and the root user. This is the correct way to complete the requirement. The other options are incorrect because they either display the current hostname status (hostnamectl status), set an invalid hostname (hostnamectl set-hostname "$(perl -le "print" "A" x 86)"), or set a transient hostname that is not persistent (hostnamectl set-hostname Comptia-WebNode --transient). Reference: CompTIA Linux+ (XK0-005) Certification Study Guide, Chapter 9: Managing System Components, page 291.

A systems administrator wants to back up the directory /data and all its contents to /backup/data on a remote server named remote. Which of the following commands will achieve the desired effect?

A.
scp -p /data remote:/backup/data
A.
scp -p /data remote:/backup/data
Answers
B.
ssh -i /remote:/backup/ /data
B.
ssh -i /remote:/backup/ /data
Answers
C.
rsync -a /data remote:/backup/
C.
rsync -a /data remote:/backup/
Answers
D.
cp -r /data /remote/backup/
D.
cp -r /data /remote/backup/
Answers
Suggested answer: C

Explanation:

The command that will back up the directory /data and all its contents to /backup/data on a remote server named remote is rsync -a /data remote:/backup/. This command uses the rsync tool, which is a remote and local file synchronization tool. It uses an algorithm to minimize the amount of data copied by only moving the portions of files that have changed. The -a option stands for archive mode, which preserves the permissions, ownership, timestamps, and symbolic links of the files. The /data argument specifies the source directory to be backed up, and the remote:/backup/ argument specifies the destination directory on the remote server. The rsync tool will create a subdirectory named data under /backup/ on the remote server, and copy all the files and subdirectories from /data on the local server.

The other options are not correct commands for backing up a directory to a remote server. The scp -p /data remote:/backup/data command will copy the /data directory as a file named data under /backup/ on the remote server, not as a subdirectory with its contents. The -p option preserves the permissions and timestamps of the file, but not the ownership or symbolic links. The ssh -i /remote:/backup/ /data command will try to use /remote:/backup/ as an identity file for SSH authentication, which is not valid. The cp -r /data /remote/backup/ command will try to copy the /data directory to a local directory named /remote/backup/, not to a remote server. Reference: CompTIA Linux+ (XK0-005) Certification Study Guide, Chapter 18: Automating Tasks; rsync(1) - Linux manual page

An administrator needs to make some changes in the IaC declaration templates. Which of the following commands would maintain version control?

A.
git clone https://github.com/comptia/linux+-.gitgit push origin
A.
git clone https://github.com/comptia/linux+-.gitgit push origin
Answers
B.
git clone https://qithub.com/comptia/linux+-.gitgit fetch New-Branch
B.
git clone https://qithub.com/comptia/linux+-.gitgit fetch New-Branch
Answers
C.
git clone https://github.com/comptia/linux+-.gitgit status
C.
git clone https://github.com/comptia/linux+-.gitgit status
Answers
D.
git clone https://github.com/comptia/linuxt+-.gitgit checkout -b <new-branch>
D.
git clone https://github.com/comptia/linuxt+-.gitgit checkout -b <new-branch>
Answers
Suggested answer: D

Explanation:

The command that will maintain version control while making some changes in the IaC declaration templates is git checkout -b <new-branch>. This command uses the git tool, which is a distributed version control system that tracks changes in source code and enables collaboration among developers. The checkout option switches to a different branch in the git repository, where a branch is a pointer to a specific commit in the history. The -b option creates a new branch with the given name, and switches to it. This way, the administrator can make changes in the new branch without affecting the main branch, and later merge them if needed.

The other options are not correct commands for maintaining version control while making some changes in the IaC declaration templates. The git clone https://github.com/comptia/linux±.git command will clone an existing repository from a remote URL to a local directory, but it will not create a new branch for making changes. The git push origin command will push the local changes to a remote repository named origin, but it will not create a new branch for making changes. The git fetch New-Branch command will fetch updates from a remote branch named New-Branch, but it will not create a new branch for making changes. Reference: CompTIA Linux+ (XK0-005) Certification Study Guide, Chapter 19: Managing Source Code; Git - Basic Branching and Merging

An administrator attempts to rename a file on a server but receives the following error.

The administrator then runs a few commands and obtains the following output:

Which of the following commands should the administrator run NEXT to allow the file to be renamed by any user?

A.
chgrp reet files
A.
chgrp reet files
Answers
B.
chacl -R 644 files
B.
chacl -R 644 files
Answers
C.
chown users files
C.
chown users files
Answers
D.
chmod -t files
D.
chmod -t files
Answers
Suggested answer: D

Explanation:

The command that the administrator should run NEXT to allow the file to be renamed by any user is chmod -t files. This command uses the chmod tool, which is used to change file permissions and access modes. The -t option removes (or sets) the sticky bit on a directory, which restricts deletion or renaming of files within that directory to only their owners or root. In this case, since files is a directory with sticky bit set (indicated by t in drwxrwxrwt), removing it will allow any user to rename or delete files within that directory.

The other options are not correct commands for allowing any user to rename files within files directory. The chgrp reet files command will change the group ownership of files directory to reet, but it will not affect its permissions or access modes. The chacl -R 644 files command is invalid, as chacl is used to change file access control lists (ACLs), not permissions or access modes. The chown users files command will change the user ownership of files directory to users, but it will not affect its permissions or access modes. Reference: CompTIA Linux+ (XK0-005) Certification Study Guide, Chapter 8: Managing Users and Groups; chmod(1) - Linux manual page

Which of the following commands will display the operating system?

A.
uname -n
A.
uname -n
Answers
B.
uname -s
B.
uname -s
Answers
C.
uname -o
C.
uname -o
Answers
D.
uname -m
D.
uname -m
Answers
Suggested answer: C

Explanation:

The command that will display the operating system is uname -o. This command uses the uname tool, which is used to print system information such as the kernel name, version, release, machine, and processor. The -o option stands for operating system, and prints the name of the operating system implementation (usually GNU/Linux).

The other options are not correct commands for displaying the operating system. The uname -n command will display the network node hostname of the system. The uname -s command will display the kernel name of the system. The uname -m command will display the machine hardware name of the system. Reference: CompTIA Linux+ (XK0-005) Certification Study Guide, Chapter 1:

Exploring Linux Command-Line Tools; uname(1) - Linux manual page

A systems engineer is adding a new 1GB XFS filesystem that should be temporarily mounted under /ops/app. Which of the following is the correct list of commands to achieve this goal?

A.
A.
Answers
B.
B.
Answers
C.
C.
Answers
D.
D.
Answers
Suggested answer: D

Explanation:

The list of commands in option D is the correct way to achieve the goal. The commands are as follows:

fallocate -l 1G /ops/app.img creates a 1GB file named app.img under the /ops directory.

mkfs.xfs /ops/app.img formats the file as an XFS filesystem.

mount -o loop /ops/app.img /ops/app mounts the file as a loop device under the /ops/app directory.

The other options are incorrect because they either use the wrong commands (dd or truncate instead of fallocate), the wrong options (-t or -f instead of -o), or the wrong order of arguments (/ops/app.img /ops/app instead of /ops/app /ops/app.img). Reference: CompTIA Linux+ (XK0-005) Certification Study Guide, Chapter 10: Managing Storage, pages 323-324.

A Linux administrator recently downloaded a software package that is currently in a compressed file.

Which of the following commands will extract the files?

A.
unzip -v
A.
unzip -v
Answers
B.
bzip2 -z
B.
bzip2 -z
Answers
C.
gzip
C.
gzip
Answers
D.
funzip
D.
funzip
Answers
Suggested answer: C

Explanation:

The command gzip can extract files that are compressed with the gzip format, which has the extension .gz. This is the correct command to use for the software package. The other options are incorrect because they either compress files (bzip2 -z), unzip files that are compressed with the zip format (unzip -v or funzip), or have the wrong options (-v or -z instead of -d). Reference: CompTIA Linux+ (XK0-005) Certification Study Guide, Chapter 11: Managing Files and Directories, page 353.

A Linux administrator is troubleshooting SSH connection issues from one of the workstations.

When users attempt to log in from the workstation to a server with the IP address 104.21.75.76, they receive the following message:

The administrator reviews the information below:

Which of the following is causing the connectivity issue?

A.
The workstation has the wrong IP settings.
A.
The workstation has the wrong IP settings.
Answers
B.
The sshd service is disabled.
B.
The sshd service is disabled.
Answers
C.
The server's firewall is preventing connections from being made.
C.
The server's firewall is preventing connections from being made.
Answers
D.
The server has an incorrect default gateway configuration.
D.
The server has an incorrect default gateway configuration.
Answers
Suggested answer: C

Explanation:

The server's firewall is preventing connections from being made, which is causing the connectivity issue. The output of iptables -L -n shows that the firewall is blocking all incoming traffic on port 22, which is the default port for SSH. The output of ssh -v [email protected] shows that the connection is refused by the server. To resolve the issue, the administrator needs to allow port 22 on the firewall.

The other options are incorrect because they are not supported by the outputs. The workstation has the correct IP settings, as shown by the output of ip addr show. The sshd service is enabled and running, as shown by the output of systemctl status sshd. The server has the correct default gateway configuration, as shown by the output of ip route show. Reference: CompTIA Linux+ (XK0-005) Certification Study Guide, Chapter 13: Managing Network Services, pages 406-407.

DRAG DROP

As a Systems Administrator, to reduce disk space, you were tasked to create a shell script that does the following:

Add relevant content to /tmp/script.sh, so that it finds and compresses rotated files in /var/log without recursion.

INSTRUCTIONS Fill the blanks to build a script that performs the actual compression of rotated log files.

If at any time you would like to bring back the initial state of the simulation, please click the Reset All button.


Question 39
Correct answer: Question 39

Explanation:


Which of the following files holds the system configuration for journal when running systemd?

A.
/etc/systemd/journald.conf
A.
/etc/systemd/journald.conf
Answers
B.
/etc/systemd/systemd-journalctl.conf
B.
/etc/systemd/systemd-journalctl.conf
Answers
C.
/usr/lib/systemd/journalctl.conf
C.
/usr/lib/systemd/journalctl.conf
Answers
D.
/etc/systemd/systemd-journald.conf
D.
/etc/systemd/systemd-journald.conf
Answers
Suggested answer: A

Explanation:

The file that holds the system configuration for journal when running systemd is /etc/systemd/journald.conf. This file contains various settings that control the behavior of the journald daemon, which is responsible for collecting and storing log messages from various sources.

The journald.conf file can be edited to change the default values of these settings, such as the storage location, size limits, compression, and forwarding options of the journal files. The file also supports a drop-in directory /etc/systemd/journald.conf.d/ where additional configuration files can be placed to override or extend the main file. Reference: CompTIA Linux+ (XK0-005) Certification Study Guide, Chapter 18: Automating Tasks; journald.conf(5) - Linux manual page

Total 371 questions
Go to page: of 38