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.

Thanks.

link|improve this question

71% accept rate
feedback

2 Answers

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.

link|improve this answer
So it won't work with a basic home router? – Jonathan 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? – Jonathan 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. – Jonathan Haddad Jan 30 '10 at 6:08
1  
.local is mDNS, which is implemented for Linux as avahi-daemon – grawity Jan 30 '10 at 14:22
show 2 more comments
feedback

no need to reboot

1 /etc/hosts

2 /etc/sysconfig/network

3 /bin/hostname

$su -c service syslog restart

logout

login

link|improve this answer
feedback

Your Answer

 
or
required, but never shown

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