XK0-005 · Question #1195
A systems administrator received a request to change the hostname to a new name. Which of the following file configurations should be changed to fix the hostname in the server?
The correct answer is A. /etc/sysconfig/network. On Red Hat-based systems (RHEL, CentOS), the persistent hostname configuration is stored in /etc/sysconfig/network using the 'HOSTNAME=newname' directive. Changing it there (along with running 'hostname newname' for the live session) ensures the hostname persists across…
Question
Options
- A/etc/sysconfig/network
- B/etc/hosts
- C/etc/resolv.conf
- D/etc/sysconfig/nsswitch.conf
How the community answered
(32 responses)- A94% (30)
- B3% (1)
- C3% (1)
Explanation
On Red Hat-based systems (RHEL, CentOS), the persistent hostname configuration is stored in /etc/sysconfig/network using the 'HOSTNAME=newname' directive. Changing it there (along with running 'hostname newname' for the live session) ensures the hostname persists across reboots. The other files serve different purposes: /etc/hosts maps hostnames to IP addresses for local resolution but does not set the system hostname, /etc/resolv.conf configures DNS nameservers and search domains, and /etc/sysconfig/nsswitch.conf is not a standard file (the correct path is /etc/nsswitch.conf, which controls name service switch lookup order). On modern systemd systems, /etc/hostname is also used, but the exam context points to /etc/sysconfig/network.
Topics
Community Discussion
No community discussion yet for this question.