ExamGecko
Home Home / CompTIA / XK0-005

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

Question list
Search
Search

List of questions

Search

Related questions











Which of the following commands is used to tune kernel parameters?

A.

sysctl

A.

sysctl

Answers
B.

ss

B.

ss

Answers
C.

mkinitrd

C.

mkinitrd

Answers
D.

lsof

D.

lsof

Answers
Suggested answer: A

Explanation:

sysctl is used to modify kernel parameters at runtime. It is used for setting system settings related to networking, memory management, and other kernel options. These settings are stored in /etc/sysctl.conf for persistence across reboots.

A security team discovers that a web server has been running with elevated privileges and identifies it as a security violation. Which of the following items needs to be added to the webserver.service file to remediate the issue?

A.

In the [Service] section of the webserver.service file, add User=comptia.

A.

In the [Service] section of the webserver.service file, add User=comptia.

Answers
B.

In the [Unit] section of the webserver.service file, add AllowIsolate=true.

B.

In the [Unit] section of the webserver.service file, add AllowIsolate=true.

Answers
C.

In the [Install] section of the webserver.service file, add WantedBy=single.target.

C.

In the [Install] section of the webserver.service file, add WantedBy=single.target.

Answers
D.

Add After=network.target to the [Install] section of the webserver.service file.

D.

Add After=network.target to the [Install] section of the webserver.service file.

Answers
Suggested answer: A

Explanation:

Adding User=comptia in the [Service] section ensures that the web server runs as a non-root user, which enhances security by reducing the risk of elevated privileges being exploited. This follows the principle of least privilege, a best practice for system services.

Which of the following paths stores the configuration files in a Linux filesystem?

A.

/proc

A.

/proc

Answers
B.

/home

B.

/home

Answers
C.

/root

C.

/root

Answers
D.

/etc

D.

/etc

Answers
Suggested answer: D

Explanation:

The /etc directory contains configuration files for system-wide settings and services in Linux. Files like /etc/fstab, /etc/hosts, and /etc/passwd reside here, controlling various aspects of system behavior and service configurations.

The users of a Linux system are unable to use one of the application filesystems. The following outputs have been provided:

bash

$ cd /app

$ touch file

touch: cannot touch 'file': Readonly file system

Output 2

/dev/sdcl on /app type ext4 (ro,relatime,seclabel,data=ordered)

Output 3

/dev/sdcl /app ext4 defaults 0 0

Output 4

[302.048075] Buffer I/O error on dev sdcl, logical block 0, async page read

[302.048490] EXT4-fs (sdcl): Attempt to read block from filesystem resulted in short read while trying to re-open /dev/sdcl

Which of the following actions will resolve this issue?

A.

umount /app fsck -y /dev/sdcl mount /app

A.

umount /app fsck -y /dev/sdcl mount /app

Answers
B.

xfs_repair /dev/sdcl mount -o rw,remount /app

B.

xfs_repair /dev/sdcl mount -o rw,remount /app

Answers
C.

umount /app xfs_repair /dev/sdcl mount /app

C.

umount /app xfs_repair /dev/sdcl mount /app

Answers
D.

fsck -y /dev/sdcl mount -o rw,remount /app

D.

fsck -y /dev/sdcl mount -o rw,remount /app

Answers
Suggested answer: D

Explanation:

The filesystem is in read-only mode, likely due to corruption or errors detected. Running fsck -y will check and repair the filesystem, and mount -o rw,remount will remount it as read-write, making it usable again. This is a common troubleshooting step for filesystems with errors.

A systems administrator is tasked with configuring a repository on an RPM-based Linux system. Which of the following need to be reviewed and modified? (Select two).

A.

/etc/yum.conf

A.

/etc/yum.conf

Answers
B.

/etc/apt/sources.list.d

B.

/etc/apt/sources.list.d

Answers
C.

/etc/pam.d

C.

/etc/pam.d

Answers
D.

/etc/apt.conf

D.

/etc/apt.conf

Answers
E.

/etc/yum.repos.d

E.

/etc/yum.repos.d

Answers
F.

/etc/ssh/ssh_config

F.

/etc/ssh/ssh_config

Answers
Suggested answer: A, E

Explanation:

On RPM-based systems like Red Hat or CentOS, repository configuration is handled via yum or dnf. The main configuration file is /etc/yum.conf, while individual repository files are stored in /etc/yum.repos.d/. These files dictate where packages are fetched from.

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

A.

systemctl stop httpd umount /dev/sdb1 xfs_repair /dev/sdb1 mount /dev/sdb1 /var/www/html systemctl start httpd

Answers
B.

umount /dev/sdb1 xfs_repair /dev/sdb1 xfs_metadump /dev/sdb1 mount /dev/sdb1 /var/www/html systemctl restart httpd

B.

umount /dev/sdb1 xfs_repair /dev/sdb1 xfs_metadump /dev/sdb1 mount /dev/sdb1 /var/www/html systemctl restart httpd

Answers
C.

umount /dev/sdb1 systemctl stop httpd xfs_metadump /dev/sdb1 mount /dev/sdb1 /var/www/html systemctl start httpd

C.

umount /dev/sdb1 systemctl stop httpd xfs_metadump /dev/sdb1 mount /dev/sdb1 /var/www/html systemctl start httpd

Answers
D.

systemctl stop httpd xfs_check -L /dev/sdb umount /var/www/html systemctl start httpd

D.

systemctl stop httpd xfs_check -L /dev/sdb umount /var/www/html systemctl start httpd

Answers
Suggested answer: 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.

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

A.

~/.ssh/authorized_keys

Most voted
Answers (1)
Most voted
B.

~/.ssh/known_hosts

B.

~/.ssh/known_hosts

Most voted
Answers (1)
Most voted
C.

/etc/ssh/ssh_config

C.

/etc/ssh/ssh_config

Answers
D.

~/.ssh/config

D.

~/.ssh/config

Answers
E.

/etc/ssh/sshd_config

E.

/etc/ssh/sshd_config

Answers
F.

/etc/ssh/ssh_host_rsa_key.pub

F.

/etc/ssh/ssh_host_rsa_key.pub

Answers
Suggested answer: 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.

A systems administrator wants to list all local account names and their respective UIDs. Which of the following commands will provide output containing this information?

A.

cut -c: -f3,1 /etc/passwd

A.

cut -c: -f3,1 /etc/passwd

Answers
B.

cut -d: -s2,3 /etc/passwd

B.

cut -d: -s2,3 /etc/passwd

Answers
C.

cut -d: -f1,3 /etc/passwd

C.

cut -d: -f1,3 /etc/passwd

Answers
D.

cut -n: -f1,2 /etc/passwd

D.

cut -n: -f1,2 /etc/passwd

Answers
Suggested answer: C

Explanation:

The /etc/passwd file contains user account information, where each line includes fields separated by colons. To list all user accounts and their UIDs, use cut -d: -f1,3 /etc/passwd. This cuts the first field (username) and the third field (UID) from each line.

A Linux systems administrator is trying to execute a particular shell script on a server. The administrator reviews the following outputs:

shell

$ ./startup.sh

bash: ./startup.sh: Permission denied

$ ls -l startup.sh

-rw-rw-r-- 1 companyabc companyabc 18 October 15:35 startup.sh

Which of the following commands should the administrator use to allow the script to run?

A.

chown root startup.sh

A.

chown root startup.sh

Answers
B.

chmod 750 startup.sh

B.

chmod 750 startup.sh

Answers
C.

chmod -x startup.sh

C.

chmod -x startup.sh

Answers
D.

chmod 400 startup.sh

D.

chmod 400 startup.sh

Answers
Suggested answer: B

Explanation:

The script is missing the execute permission. Using chmod 750 startup.sh adds execute permissions for the owner and grants read and execute permissions for the group, allowing the script to run. Without execute permissions, the shell cannot run the script.

A user is cleaning up a directory because it has more than 100,000 files that were generated from an experiment. When the user tries to remove the unneeded experiment files, the user receives an error:

arduino

cannot execute [Argument list too long]

Which of the following should the user execute to remove these files?

A.

find . -name 'experiment*.txt' -exec rm '{}' ;

A.

find . -name 'experiment*.txt' -exec rm '{}' ;

Answers
B.

rm -rf experiment*.txt

B.

rm -rf experiment*.txt

Answers
C.

rm --force experiment*.txt

C.

rm --force experiment*.txt

Answers
D.

for i in experiment*.txt; do find . -name $i -exec rmdir '{}' ; done

D.

for i in experiment*.txt; do find . -name $i -exec rmdir '{}' ; done

Answers
Suggested answer: A

Explanation:

The 'Argument list too long' error occurs when the number of files exceeds the command-line argument limit. The find command with -exec is a workaround, as it processes files one by one, avoiding the argument limit. This method is efficient for handling large numbers of files.

Total 371 questions
Go to page: of 38