ExamGecko
Home Home / CompTIA / XK0-005

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

Question list
Search
Search

List of questions

Search

Related questions











A Linux administrator would like to measure possible packet loss between a workstation and a remote web application that is running on port 443. Which of the following would be the best command for the administrator to use to display this information?

A.

ping -c 50 <remote server IP>

A.

ping -c 50 <remote server IP>

Answers
B.

tcpdump -p 443 <remote server IP>

B.

tcpdump -p 443 <remote server IP>

Answers
C.

mtr -T -P 443 <remote server IP>

C.

mtr -T -P 443 <remote server IP>

Answers
D.

traceroute -p 443 <remote server IP>

D.

traceroute -p 443 <remote server IP>

Answers
Suggested answer: C

Explanation:

mtr (My Traceroute) is a network diagnostic tool that combines the functionality of traceroute and ping. It shows real-time packet loss and latency on a hop-by-hop basis. The -T option uses TCP instead of ICMP, and the -P 443 option specifies the remote port. This provides the best method for checking packet loss on port 443.

A systems engineer deploys a new application server, but the server cannot communicate with the back-end database hostname. The engineer confirms that the application server can ping the database server's IP address. Which of the following is the most likely cause of the issue?

A.

Incorrect DNS servers

A.

Incorrect DNS servers

Answers
B.

Unreachable default gateway

B.

Unreachable default gateway

Answers
C.

Missing route configuration

C.

Missing route configuration

Answers
D.

Misconfigured subnet mask

D.

Misconfigured subnet mask

Answers
Suggested answer: A

Explanation:

If the application server can ping the database server by its IP address but not by its hostname, it indicates a DNS resolution issue. The most likely cause is incorrect DNS server configuration. The engineer should verify the DNS settings in /etc/resolv.conf or the network configuration.

A Linux administrator needs to list the packages that are currently installed on a server. Which of the following commands should the administrator use?

A.

snap install list

A.

snap install list

Answers
B.

snap list

B.

snap list

Answers
C.

snap show

C.

snap show

Answers
D.

snap packages

D.

snap packages

Answers
Suggested answer: B

Explanation:

The snap list command lists all installed Snap packages on the system. Snap is a package management system that is used for installing and managing software packages in Linux. It shows information about the installed Snap packages, including the version, publisher, and whether the package is active.

A hardened physical Linux system allows regular, unprivileged users to remotely connect to the server using SSH only. No sudo tool has been installed. Which of the following should the Linux administrator use to perform administrative tasks on this host? (Select two).

A.

Create an SSH key and copy it to the remote server to allow passwordless login

A.

Create an SSH key and copy it to the remote server to allow passwordless login

Answers
B.

Access the server's physical console and use the root user's password to log in

B.

Access the server's physical console and use the root user's password to log in

Answers
C.

Install the telnet server on this system to be able to use a root account

C.

Install the telnet server on this system to be able to use a root account

Answers
D.

Use the su command and enter the root user's password

D.

Use the su command and enter the root user's password

Answers
E.

Install the sudo command using the unprivileged user's account

E.

Install the sudo command using the unprivileged user's account

Answers
F.

Add the user to the wheel group

F.

Add the user to the wheel group

Answers
Suggested answer: B, D

Explanation:

Without sudo, the administrator must either access the system physically or use the su command to switch to the root account using the root password. Since the system is hardened and SSH is allowed, installing sudo or using Telnet would not be secure or permitted options. Physical access to the console or using su is the correct approach.

A systems administrator is creating new user accounts on several Linux machines and wants to automate the process from a Linux system used for operations. In this operations system, the list of servers is located in the /home/user/serverslist file and the list of user accounts is located in the /home/user/userslist file. Which of the following scripts will help accomplish this task?

A.

bash for server in $(cat /home/user/serverslist) do for user in $(cat /home/user/userslist) do sudo useradd $user done done

A.

bash for server in $(cat /home/user/serverslist) do for user in $(cat /home/user/userslist) do sudo useradd $user done done

Answers
B.

bash for server in $(cat /home/user/serverslist) do ssh -i user@$server 'for user in $(cat /home/user/userslist) do sudo useradd $user done; exit' done

B.

bash for server in $(cat /home/user/serverslist) do ssh -i user@$server 'for user in $(cat /home/user/userslist) do sudo useradd $user done; exit' done

Answers
C.

bash for server in $(cat /home/user/serverslist) do scp /home/user/userslist user@$server:/tmp ssh -i user@$server 'for user in $(cat /tmp/userslist) do sudo useradd $user done; exit' done

C.

bash for server in $(cat /home/user/serverslist) do scp /home/user/userslist user@$server:/tmp ssh -i user@$server 'for user in $(cat /tmp/userslist) do sudo useradd $user done; exit' done

Answers
D.

bash ssh user@$(cat /home/user/serverslist) 'sudo useradd $(cat /home/user/userslist); exit'

D.

bash ssh user@$(cat /home/user/serverslist) 'sudo useradd $(cat /home/user/userslist); exit'

Answers
Suggested answer: B

Explanation:

The script in option B performs the task by SSH-ing into each server listed in serverslist and then adding each user listed in userslist. This is an effective way to remotely create user accounts without manually logging into each server. The ssh command allows the execution of the useradd commands on the remote machines.

Which of the following directories contains binaries that only a root user should run?

A.

/sbin

A.

/sbin

Answers
B.

/bin

B.

/bin

Answers
C.

/root

C.

/root

Answers
D.

/lib

D.

/lib

Answers
Suggested answer: A

Explanation:

The /sbin directory contains essential system binaries that are typically only used by the root user. These binaries include commands like ifconfig, fdisk, and reboot, which require root privileges to execute. /bin contains user-level binaries, while /root is the home directory of the root user, and /lib holds shared libraries.

SIMULATION

A senior administrator has placed a private key for user admin in your home directory.

The server you need to remotely access is server1 and SSH is listening on port 2222.

INSTRUCTIONS

Part 1

Review the command output and build the correct command to place the private key into your SSH folder.

Part 2

Review the command output and build the correct command to set the file permissions.

Part 3

Review the command output and build the correct command to set the correct ownership.

In each part, click on objects to build a complete command. Command objects may be used more than once, but not all will be used. Use _ as the spacebar. Click the arrow to remove any unwanted objects from your command.

Part 4

Select the proper file to edit for remote server access. Then, build the correct configuration output based on the server name, ports, and files.

A.

See the Explanation part for detailed answer of each part

A.

See the Explanation part for detailed answer of each part

Answers
Suggested answer: A

Explanation:

Part 1

Here is the step-by-step command construction process:

1. Move the private key (likely named server1 based on the provided details) to the .ssh directory:

mv ~/server1 ~/.ssh/id_rsa

This command moves the private key (assuming it's named server1) from the home directory (~) to the .ssh directory and renames it to id_rsa (which is the default SSH private key file name).

2. Set the correct permissions for the private key file:

chmod 600 ~/.ssh/id_rsa

The private key file should be readable and writable only by the owner to maintain security.

3. Connect to the server using the private key and the correct port (2222):

ssh -i ~/.ssh/id_rsa -p 2222 admin@server1

This command tells ssh to use the specified private key (-i ~/.ssh/id_rsa), connect on port 2222 (-p 2222), and log in as the admin user on server1.

Part 2: Setting File Permissions

The correct command to set the file permissions based on the screenshots would likely involve using chmod. Here is the command to set permissions correctly:

chmod 600 ~/.ssh/id_rsa

This restricts the private key's permissions so that only the user can read and write it.

Part 3: Setting Ownership

If ownership needs to be set, the command would look like this:

chown comptia:comptia ~/.ssh/id_rsa

This command ensures that the file is owned by the correct user (comptia) and the correct group (comptia).

In part 4, it asks you to select the proper file for editing to enable remote server access. Based on standard SSH configuration requirements, the proper file to edit for remote server access would be ~/.ssh/config.

Here's why:

~/.ssh/config: This file allows you to set up configuration options for different hosts, including specifying ports, user names, and the identity file (private key). You would add the necessary configuration for server1 to this file for easier access.

Other options:

~/.ssh/authorized_keys: This file lists public keys that are authorized to log in to the local system. It's not meant for configuring remote access to another server.

~/.ssh/known_hosts: This file stores the host keys of servers you've connected to. It doesn't allow for editing remote access settings.

~/.ssh/server1: This seems like a private key file or another custom file, but it's not typically used to configure SSH options.

For configuring access to server1 on port 2222, you would add a block like this to the ~/.ssh/config file:

Host server1

HostName server1

Port 2222

User admin

IdentityFile ~/.ssh/id_rsa



A systems administrator is cloning a system partition /dev/sda1 to /dev/sdc1. Which of the following commands would allow the administrator to accomplish this task most efficiently?

A.

dd if=/dev/sda1 of=/dev/sdc1

A.

dd if=/dev/sda1 of=/dev/sdc1

Answers
B.

cat /dev/sda1 > /dev/sdc1

B.

cat /dev/sda1 > /dev/sdc1

Answers
C.

cp -R /dev/sda1 /dev/sdc1

C.

cp -R /dev/sda1 /dev/sdc1

Answers
D.

rsync -av /dev/sda1 /dev/sdc1

D.

rsync -av /dev/sda1 /dev/sdc1

Answers
Suggested answer: A

Explanation:

The dd command is the most efficient method to clone a partition, as it operates at the block level. The command dd if=/dev/sda1 of=/dev/sdc1 copies the entire content of /dev/sda1 (input file) to /dev/sdc1 (output file), making an exact clone of the partition. The other options are either not applicable or less efficient for partition cloning.

A Linux administrator encounters the following error in the Apache log files:

css

SQLSTATE[HY000] [2002] Permission denied

Which of the following commands should the administrator run to safely fix this issue?

A.

chcon -c httpd_sys_content_t /home/apache

A.

chcon -c httpd_sys_content_t /home/apache

Answers
B.

setsebool -F httpd_can_network_connect_db on

B.

setsebool -F httpd_can_network_connect_db on

Answers
C.

setenforce 0

C.

setenforce 0

Answers
D.

touch /.autorelabel

D.

touch /.autorelabel

Answers
Suggested answer: B

Explanation:

The error indicates that SELinux is preventing Apache from connecting to the database. The command setsebool -F httpd_can_network_connect_db on allows the Apache web server to make network connections to the database, resolving the permission denied error without disabling SELinux entirely.

A hardened physical Linux system allows regular, unprivileged users to remotely connect to the server using SSH only. No sudo tool has been installed. Which of the following should the Linux administrator use to perform administrative tasks on this host? (Select two).

A.

Create an SSH key and copy it to the remote server to allow passwordless login

A.

Create an SSH key and copy it to the remote server to allow passwordless login

Answers
B.

Access the server's physical console and use the root user's password to log in

B.

Access the server's physical console and use the root user's password to log in

Answers
C.

Install the telnet server on this system to be able to use a root account

C.

Install the telnet server on this system to be able to use a root account

Answers
D.

Use the su command and enter the root user's password

D.

Use the su command and enter the root user's password

Answers
E.

Install the sudo command using the unprivileged user's account

E.

Install the sudo command using the unprivileged user's account

Answers
F.

Add the user to the wheel group

F.

Add the user to the wheel group

Answers
Suggested answer: B, D

Explanation:

As the sudo tool is not installed on the system, administrative tasks must be performed either via direct physical console access or by switching to the root user using the su command. Both methods require knowledge of the root password. Installing Telnet is not a good option due to its lack of security, and installing sudo using an unprivileged user is not possible without root privileges.

Total 371 questions
Go to page: of 38