Take the 2-minute tour ×
Unix & Linux Stack Exchange is a question and answer site for users of Linux, FreeBSD and other Un*x-like operating systems.. It's 100% free, no registration required.

I changed the name of the hosts in /etc/hosts to

IP.GOES.HERE newname

Apache does recognize the new server name; but still, via ssh i get this on the ssh prompt:


Why? Where else do I need to change the server name?

I'm using CentOS 6.3

share|improve this question
You need to change the system hostname properly (where "properly" depends entirely on your operating system, which you haven't seen fit to tell us...) –  voretaq7 Jun 3 '13 at 21:18
Sorry for that, just updated the question with that info (CentOS 6.3) –  andufo Jun 3 '13 at 21:20
add comment

migrated from serverfault.com Jun 4 '13 at 11:06

This question came from our site for professional system and network administrators.

1 Answer

up vote 1 down vote accepted

On CentOS you set the system hostname in /etc/sysconfig/network.
This setting change takes effect on reboot. To change the hostname on a running system without rebooting use the hostname command.

share|improve this answer
Thanks for that! –  andufo Jun 3 '13 at 21:31
Should clarify that only changing the hostname with the hostname command will set the hostname but will not change the /etc/sysconfig/network configuration. The change wont be persistent over a reboot. –  artifex Jun 3 '13 at 21:37
Also, changing the hostname while the system is running will not affect processes (e.g. Apache) that started with the old name. It's really a cleaner approach to just change /etc/sysconfig/network and reboot, if that's at all an option for you. –  asciiphil Jun 3 '13 at 22:53
add comment

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.