Take the 2-minute tour ×
Server Fault is a question and answer site for professional system and network administrators. It's 100% free, no registration required.

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.

share|improve this question

2 Answers 2

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? –  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

no need to reboot

1 /etc/hosts

2 /etc/sysconfig/network

3 /bin/hostname

$su -c service syslog restart

logout

login

share|improve this answer

Your Answer

 
discard

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.