ExamGecko
Home Home / CompTIA / XK0-005

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

Question list
Search
Search

List of questions

Search

Related questions











An administrator created an initial Git repository and uploaded the first files. The administrator sees the following when listing the repository:

The administrator notices the file . DS STORE should not be included and deletes it from the online repository. Which of the following should the administrator run from the root of the local repository before the next commit to ensure the file is not uploaded again in future commits?

A.
rm -f .DS STORE && git push
A.
rm -f .DS STORE && git push
Answers
B.
git fetch && git checkout .DS STORE
B.
git fetch && git checkout .DS STORE
Answers
C.
rm -f .DS STORE && git rebase origin main
C.
rm -f .DS STORE && git rebase origin main
Answers
D.
echo .DS STORE >> .gitignore
D.
echo .DS STORE >> .gitignore
Answers
Suggested answer: D

Explanation:

The correct answer is D. The administrator should run ''echo .DS STORE >> .gitignore'' from the root of the local repository before the next commit to ensure the file is not uploaded again in future commits.

This command will append the file name .DS STORE to the end of the .gitignore file, which is a special file that tells Git to ignore certain files or directories that should not be tracked or uploaded to the repository. By adding .DS STORE to the .gitignore file, the administrator will prevent Git from staging, committing, or pushing this file in the future.

The other options are incorrect because:

A) rm -f .DS STORE && git push

This command will delete the file .DS STORE from the local repository and then push the changes to the remote repository. However, this does not prevent the file from being uploaded again in future commits, if it is recreated or copied to the local repository.

B) git fetch && git checkout .DS STORE

This command will fetch the latest changes from the remote repository and then restore the file .DS STORE from the remote repository to the local repository. This is not what the administrator wants to do, as this will undo the deletion of the file from the online repository.

C) rm -f .DS STORE && git rebase origin main

This command will delete the file .DS STORE from the local repository and then rebase the local branch onto the main branch of the remote repository. This will rewrite the commit history of the local branch and may cause conflicts or errors. This is not what the administrator wants to do, as this is a risky and unnecessary operation.

Users are unable to create new files on the company's FTP server, and an administrator is troubleshooting the issue. The administrator runs the following commands:

Which of the following is the cause of the issue based on the output above?

A.
The users do not have the correct permissions to create files on the FTP server.
A.
The users do not have the correct permissions to create files on the FTP server.
Answers
B.
The ftpusers filesystem does not have enough space.
B.
The ftpusers filesystem does not have enough space.
Answers
C.
The inodes is at full capacity and would affect file creation for users.
C.
The inodes is at full capacity and would affect file creation for users.
Answers
D.
ftpusers is mounted as read only.
D.
ftpusers is mounted as read only.
Answers
Suggested answer: C

Explanation:

The cause of the issue based on the output above is C. The inodes is at full capacity and would affect file creation for users.

An inode is a data structure that stores information about a file or directory, such as its name, size, permissions, owner, timestamps, and location on the disk. Each file or directory has a unique inode number that identifies it. The number of inodes on a filesystem is fixed when the filesystem is created, and it determines how many files and directories can be created on that filesystem. If the inodes are exhausted, no new files or directories can be created, even if there is enough disk space available.

The output for the second command shows that the /ftpusers/ filesystem has 0% of inodes available, which means that all the inodes have been used up. This would prevent users from creating new files on the FTP server. The administrator should either delete some unused files or directories to free up some inodes, or resize the filesystem to increase the number of inodes.

The other options are incorrect because:

A) The users do not have the correct permissions to create files on the FTP server.

This is not true, because the output for the first command shows that the /ftpusers/ filesystem has 26% of disk space available, which means that there is enough space for users to create files. The permissions of the files and directories are not shown in the output, but they are not relevant to the issue of inode exhaustion.

B) The ftpusers filesystem does not have enough space.

This is not true, because the output for the first command shows that the /ftpusers/ filesystem has 26% of disk space available, which means that there is enough space for users to create files. The issue is not related to disk space, but to inode capacity.

D) ftpusers is mounted as read only.

This is not true, because the output for the first command does not show any indication that the /ftpusers/ filesystem is mounted as read only. If it was, it would have an (ro) flag next to the mounted on column. A read only filesystem would prevent users from creating or modifying files on the FTP server, but it would not affect the inode usage.

An administrator added the port 2222 for the SSH server on myhost and restarted the SSH server. The administrator noticed issues during the startup of the service. Given the following outputs:

Which of the following commands will fix the issue?

A.
semanage port -a -t ssh_port_t -p tcp 2222
A.
semanage port -a -t ssh_port_t -p tcp 2222
Answers
B.
chcon system_u:object_r:ssh_home_t /etc/ssh/*
B.
chcon system_u:object_r:ssh_home_t /etc/ssh/*
Answers
C.
iptables -A INPUT -p tcp -- dport 2222 -j ACCEPT
C.
iptables -A INPUT -p tcp -- dport 2222 -j ACCEPT
Answers
D.
firewall-cmd -- zone=public -- add-port=2222/tcp
D.
firewall-cmd -- zone=public -- add-port=2222/tcp
Answers
Suggested answer: A

Explanation:

The correct answer is

A) semanage port -a -t ssh_port_t -p tcp 2222

This command will allow the SSH server to bind to port 2222 by adding it to the SELinux policy. The semanage command is a utility for managing SELinux policies. The port subcommand is used to manage network port definitions. The -a option is used to add a new record, the -t option is used to specify the SELinux type, the -p option is used to specify the protocol, and the tcp 2222 argument is used to specify the port number. The ssh_port_t type is the default type for SSH ports in SELinux.

The other options are incorrect because:

B) chcon system_u:object_r:ssh_home_t /etc/ssh/*

This command will change the SELinux context of all files under /etc/ssh/ to system_u:object_r:ssh_home_t, which is not correct. The ssh_home_t type is used for user home directories that are accessed by SSH, not for SSH configuration files. The correct type for SSH configuration files is sshd_config_t.

C) iptables -A INPUT -p tcp --dport 2222 -j ACCEPT

This command will add a rule to the iptables firewall to accept incoming TCP connections on port 2222. However, this is not enough to fix the issue, as SELinux will still block the SSH server from binding to that port. Moreover, iptables may not be the default firewall service on some Linux distributions, such as Fedora or CentOS, which use firewalld instead.

D) firewall-cmd --zone=public --add-port=2222/tcp

This command will add a rule to the firewalld firewall to allow incoming TCP connections on port 2222 in the public zone. However, this is not enough to fix the issue, as SELinux will still block the SSH server from binding to that port. Moreover, firewalld may not be installed or enabled on some Linux distributions, such as Ubuntu or Debian, which use iptables instead.

How to configure SSH to use a non-standard port with SELinux set to enforcing

Change SSH Port on CentOS/RHEL/Fedora With SELinux Enforcing

How to change SSH port when SELinux policy is enabled

After starting an Apache web server, the administrator receives the following error:

Apr 23 localhost.localdomain httpd 4618] : (98) Address already in use: AH00072: make_sock: could not bind to address [: :]80

Which of the following commands should the administrator use to further trou-bleshoot this issue?

A.
Ss
A.
Ss
Answers
B.
Ip
B.
Ip
Answers
C.
Dig
C.
Dig
Answers
D.
Nc
D.
Nc
Answers
Suggested answer: A

Explanation:

The ss command is used to display information about socket connections, such as the port number, state, and process ID. The error message indicates that the port 80 is already in use by another process, which prevents the Apache web server from binding to it. By using the ss command with the -l and -n options, the administrator can list all the listening sockets and their port numbers in numeric form, and identify which process is using the port 80. For example:ss -ln | grep :80. The ip, dig, and nc commands are not relevant for this issue, as they are used for different purposes, such as configuring network interfaces, querying DNS records, and testing network connectivity.

A systems administrator detected corruption in the /data filesystem. Given the following output:

Which of the following commands can the administrator use to best address this issue?

A.
umount /data mkfs . xfs /dev/sclcl mount /data
A.
umount /data mkfs . xfs /dev/sclcl mount /data
Answers
B.
umount /data xfs repair /dev/ sdcl mount /data
B.
umount /data xfs repair /dev/ sdcl mount /data
Answers
C.
umount /data fsck /dev/ sdcl mount / data
C.
umount /data fsck /dev/ sdcl mount / data
Answers
D.
umount /data pvs /dev/sdcl mount /data
D.
umount /data pvs /dev/sdcl mount /data
Answers
Suggested answer: B

Explanation:

The xfs repair command is used to check and repair an XFS filesystem, which is the type of filesystem used for the /data partition, as shown in the output. The administrator needs to unmount the /data partition before running the xfs repair command on it, and then mount it back after the repair is done. For example:umount /data; xfs_repair /dev/sdcl; mount /data. The mkfs.xfs command is used to create a new XFS filesystem, which would erase all the data on the partition. The fsck command is used to check and repair other types of filesystems, such as ext4, but not XFS. The pvs command is used to display information about physical volumes in a logical volume manager (LVM) setup, which is not relevant for this issue.

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
A.
[root@nodea ssh ---i ~/ . ssh/d rsa root@nodeb
Answers
B.
[root@nodea scp -i . ssh/id rsa root@nodeb
B.
[root@nodea scp -i . ssh/id rsa root@nodeb
Answers
C.
[root@nodea ssh---copy-id ---i .ssh/id rsa root@nodeb
C.
[root@nodea ssh---copy-id ---i .ssh/id rsa root@nodeb
Answers
D.
[root@nodea # ssh add -c ~/ . ssh/id rsa root@nodeb
D.
[root@nodea # ssh add -c ~/ . ssh/id rsa root@nodeb
Answers
E.
[root@nodea # ssh add -c ~/. ssh/id rsa root@nodeb
E.
[root@nodea # ssh add -c ~/. ssh/id rsa root@nodeb
Answers
Suggested answer: 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.

An administrator attempts to connect to a remote server by running the following command:

$ nmap 192.168.10.36

Starting Nmap 7.60 ( https://nmap.org ) at 2022-03-29 20:20 UTC

Nmap scan report for www1 (192.168.10.36)

Host is up (0.000091s latency).

Not shown: 979 closed ports

PORT STATE SERVICE

21/tcp open ftp

22/tcp filtered ssh

631/tcp open ipp

Nmap done: 1 IP address (1 host up) scanned in 0.06 seconds

Which of the following can be said about the remote server?

A.
A firewall is blocking access to the SSH server.
A.
A firewall is blocking access to the SSH server.
Answers
B.
The SSH server is not running on the remote server.
B.
The SSH server is not running on the remote server.
Answers
C.
The remote SSH server is using SSH protocol version 1.
C.
The remote SSH server is using SSH protocol version 1.
Answers
D.
The SSH host key on the remote server has expired.
D.
The SSH host key on the remote server has expired.
Answers
Suggested answer: A

Explanation:

This is because the port 22/tcp is shown as filtered by nmap, which means that nmap cannot determine whether the port is open or closed because a firewall or other device is blocking its probes. If the SSH server was not running on the remote server, the port would be shown as closed, which means that nmap received a TCP RST packet in response to its probe. If the remote SSH server was using SSH protocol version 1, the port would be shown as open, which means that nmap received a TCP SYN/ACK packet in response to its probe. If the SSH host key on the remote server had expired, the port would also be shown as open, but the SSH client would display a warning message about the host key verification failure. Therefore, the best explanation for the filtered state of the port 22/tcp is that a firewall is preventing nmap from reaching the SSH server.

You can find more information about nmap port states and how to interpret them in the following web search results:

Nmap scan what does STATE=filtered mean?

How to find ports marked as filtered by nmap

Technical Tip: NMAP scan shows ports as filtered

A systems administrator notices the process list on a mission-critical server has a large number of processes that are in state 'Z' and marked as 'defunct.' Which of the following should the administrator do in an attempt to safely remove these entries from the process list?

A.
Kill the process with PID 1.
A.
Kill the process with PID 1.
Answers
B.
Kill the PID of the processes.
B.
Kill the PID of the processes.
Answers
C.
Kill the parent PID of the processes.
C.
Kill the parent PID of the processes.
Answers
D.
Reboot the server.
D.
Reboot the server.
Answers
Suggested answer: C

Explanation:

As the web search results show, processes in state Z are defunct or zombie processes, which means they have terminated but their parent process has not reaped them properly. They do not consume any resources, but they occupy a slot in the process table. To remove them from the process list, the administrator needs to kill the parent process of the zombies, which will cause them to be reaped by the init process (PID 1). Killing the zombies themselves or the init process will not have any effect, as they are already dead. Rebooting the server may work, but it is not a safe or efficient option, as it may cause unnecessary downtime or data loss for a mission-critical server.

Reference

Processes in a Zombie (Z) or Defunct State | Support | SUSE, paragraph 3

linux - Zombie vs Defunct processes? - Stack Overflow, answer by admirableadmin

How To Kill Zombie Processes on Linux | Linux Journal, paragraph 4

A Linux administrator found many containers in an exited state. Which of the following commands will allow the administrator to clean up the containers in an exited state?

A.
docker rm -- all
A.
docker rm -- all
Answers
B.
docker rm $ (docker ps -aq)
B.
docker rm $ (docker ps -aq)
Answers
C.
docker images prune *
C.
docker images prune *
Answers
D.
docker rm -- state exited
D.
docker rm -- state exited
Answers
Suggested answer: B

Explanation:

This command will remove all containers, regardless of their state, by passing the IDs of all containers to the docker rm command. The docker ps -aq command will list the IDs of all containers, including the ones in an exited state, and the $ ( ) syntax will substitute the output of the command as an argument for the docker rm command. This is a quick and easy way to clean up all containers, but it may also remove containers that are still needed or running.

Reference

docker rm | Docker Docs - Docker Documentation, section ''Remove all containers''

Docker Remove Exited Containers | Easy methods. - Bobcares, section ''For removing all exited containers''

Which of the following is the best tool for dynamic tuning of kernel parameters?

A.
tuned
A.
tuned
Answers
B.
tune2fs
B.
tune2fs
Answers
C.
tuned-adm
C.
tuned-adm
Answers
D.
turbostat
D.
turbostat
Answers
Suggested answer: A

Explanation:

The tuned application is the best tool for dynamic tuning of kernel parameters, as it monitors the system and optimizes the performance under different workloads. It provides a number of predefined profiles for typical use cases, such as power saving, low latency, high throughput, virtual machine performance, and so on. It also allows users to create, modify, and delete profiles, and to switch between them on the fly. The tuned application uses the sysctl command and the configuration files in the /etc/sysctl.d/ directory to adjust the kernel parameters at runtime.

Reference

Chapter 2. Getting started with TuneD - Red Hat Customer Portal, paragraph 1

Kernel tuning with sysctl - Linux.com, paragraph 1

Total 371 questions
Go to page: of 38