[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Re: rename a machine



On Tue, 6 Aug 1996, Warwick HARVEY wrote:

> >  Can anyone tell me how to _Permanently_ change the hostname on my
> >  machine ???
> >
> >  If I issue the hostname command: hostname newname
> >
> >  the node name is set to newname - HOWEVER after a reboot the
> >  original name returns.
>
> The host name of a machine is stored in /etc/hostname. This file
> is read by /etc/init.d/boot at boot time. Change it here and it's
> "permanent".

lots of other config files may have the old hostname as well.  When i change
the hostname on a machine i usually edit /etc/hostname as mentioned above,
and then grep in /etc for any other files containing the hostname.

e.g. if the old hostname is "oldhost", then:

    find /etc | xargs grep -l oldhost

will give a list of files containing the word oldhost.  edit them with your
favourite text editor (vi!) to change them.

some files will just want the hostname.  some will want
hostname.domain.name.  check the relevant man pages to be sure if it isn't
obvious from the file you are editing.


> /etc/hosts
> /etc/mailname
> /etc/smail/config

yep, also look in /etc/mail/sendmail.mc, /etc/mail/sendmail.cw if you are
running sendmail.  the "find ... | grep ..." command above should find them
all.

Craig




Reply to: