Server Fault is a question and answer site for system and network administrators. It's 100% free, no registration required.

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I'm using CentOS 5. How do I change the hostname of the machine so I can ssh to it from other boxes by a short hostname? I've tried "hostname puppet", changing "/etc/sysconfig/network" and "sysctl kernel.hostname=puppet". I'd like to be able to do this without making changes to any hostfiles.


share|improve this question
up vote 3 down vote accepted

You either have to setup a local DNS server or you will have to change hostfiles. The changes you did will work, only to be identified in the local system and not from other systems.

share|improve this answer
So it won't work with a basic home router? – Jon Haddad Jan 30 '10 at 5:25
I can hit my Mac from another computer by typing in "ping haddad-desktop". Why would this work and not the changes on the linux box? – Jon Haddad Jan 30 '10 at 5:31
It might be doing so with the help of NETBIOS/WINS thing. I am not too much into windows to explain that. – proy Jan 30 '10 at 5:36
I rebooted the box after changing "/etc/sysconfig/network" and it seems to be working. I also did the sysctl command, so I'm not sure which one would have done it. – Jon Haddad Jan 30 '10 at 6:08
.local is mDNS, which is implemented for Linux as avahi-daemon – grawity Jan 30 '10 at 14:22

no need to reboot

1 /etc/hosts

2 /etc/sysconfig/network

3 /bin/hostname

$su -c service syslog restart



share|improve this answer

Your Answer


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

Not the answer you're looking for? Browse other questions tagged or ask your own question.