A systems administrator created a new Docker image called test. After building the image, the administrator forgot to version the release. Which of the following will allow the administrator to assign the v1 version to the image?
Answer : C
The docker image tag test test:v1 command can be used to assign the v1 version to the image called test. This command creates a new tag for the existing image, without changing the original image. The docker image save test test:v1 command would save the image to a file, not assign a version. The docker image build test:vl command is invalid, as vl is not a valid version number. The docker image version test:v1 command does not exist.:[CompTIA Linux+ (XK0-005) Certification Study Guide], Chapter 16: Virtualization and Cloud Technologies, page 500.
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?
Answer : A
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
A server administrator has scheduled a cron job to run YUM updates on all servers without manual intervention, but kernel packages must be excluded from the updates at all times. Which of the following configuration files needs to be modified to make these changes persistent?
Answer : A
The /etc/yum.conf file contains configuration settings for the YUM package manager. To exclude kernel updates, the administrator should add exclude=kernel* to the [main] section of this file. This ensures that all future YUM updates skip kernel packages, making the exclusion persistent.
A systems administrator needs to remove a disk from a Linux server. The disk size is 500G, and it is the only one that size on that machine. Which of the following commands can the
administrator use to find the corresponding device name?
Answer : D
The lsscsi command can list the SCSI devices on the system, along with their size and device name. The -s option shows the size of each device. The administrator can look for the device that has a size of 500G and note its device name. Seelsscsi(8) - Linux man pageandHow to check Disk Interface Types in Linux.1: https://linux.die.net/man/8/lsscsi2: https://www.golinuxcloud.com/check-disk-type-linux/
An administrator accidentally installed the httpd RPM package along with several dependencies. Which of the following options is the best way for the administrator to revert the package
installation?
dnf clean all
rpm -e httpd
apt-get clean
yum history undo last
The yum history undo last command will undo the last transaction, which in this case is the installation of the httpd RPM package and its dependencies. This will remove the packages that were installed and restore the previous state of the system. SeeHow to undo or redo yum transactionsandyum history.1: https://www.redhat.com/sysadmin/undo-redo-yum-transactions2: https://man7.org/linux/man-pages/man8/yum.8.html#HISTORY
A new Linux systems administrator just generated a pair of SSH keys that should allow connection to the servers. Which of the following commands can be used to copy a key file to remote servers? (Choose two.)
Answer : D, F
The commandsssh-copy-idandscpcan be used to copy a key file to remote servers. The commandssh-copy-idcopies the public key to the authorized_keys file on the remote server, which allows the user to log in without a password. The commandscpcopies files securely over SSH, which can be used to transfer the key file to any location on the remote server. The other options are incorrect because they are not related to copying key files. The commandwgetdownloads files from the web, the commandssh-keygengenerates key pairs, the commandssh-keyscancollects public keys from remote hosts, and the commandftpdis a FTP server daemon.:CompTIA Linux+ (XK0-005) Certification Study Guide, Chapter 13: Managing Network Services, pages 408-410.
A file called testfile has both uppercase and lowercase letters:
$ cat testfile
ABCDEfgH
IJKLmnoPQ
abcdefgH
ijklLMNopq
A Linux administrator is tasked with converting testfile into all uppercase and writing it to a new file with the name uppercase. Which of the following commands will achieve
this task?
Answer : D
This command will use the tr tool to translate all lowercase letters in the testfile to uppercase letters and write the output to the uppercase file. The first argument '[a-z]' specifies the set of characters to be replaced, and the second argument '[A-Z]' specifies the set of characters to replace with.The '<' symbol redirects the input from the testfile, and the '>' symbol redirects the output to the uppercase file12.
:1:Linux Tr Command - javatpoint2:Linux tr Command with Examples - phoenixNAP
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?
Answer : D
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.