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.



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.

| 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
  • 1
    .local is mDNS, which is implemented for Linux as avahi-daemon – user1686 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



| improve this answer | |

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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