CompTIA Linux+ (XK0-005) — Question 20
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?
Answer options
- A. hostnamectl status --no-ask-password
- B. hostnamectl set-hostname "$(perl -le "print" "A" x 86)"
- C. hostnamectl set-hostname Comptia-WebNode -H[email protected]
- D. hostnamectl set-hostname Comptia-WebNode --transient
Correct answer: C
Explanation
The correct option is C because it sets the hostname of the server to 'Comptia-WebNode' and specifies a remote host for the operation, which is necessary for tagging the API. Option A simply checks the status without making changes, B attempts to set a hostname using a Perl command which is irrelevant, and D sets a transient hostname that won't persist across reboots, making it unsuitable for a permanent API tag.