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

Re: hostname



Tom Allison wrote:
> >have you tried to edit /etc/hostname file?
> 
> OK, I got it, but why would the command hostname not address this?
> It's kind of... inconsistent.

The 'hostname' command is used by the startup scripts to set the
hostname.  But by itself it does not know if it is running on Debian
or SuSE or Gentoo.  It does not know where this information would be
stored at boot time.  Everyone does it differently.  It does not know
to edit a file.  In fact it is told by the start up scripts with the
information from that file.

Basically you are thinking backwards.  You are thinking that you
should run hostname to permanently change the system name.  But to
permanently change the system name on Debian you should edit
/etc/hostname and then reboot.  Don't forget /etc/mailname too.

I won't even suggest running /etc/init.d/hostname.sh without rebooting
in this case.  There is too much baggage to recommend restarting
everything that needs it.  All of the mail daemons.  Possibly
networking.  Possibly many things.  Simpler to reboot after changing
something fundamental like the kernel or the hostname.

Because it is so complicated to get right and so different between
distros there is no single command to run to change the hostname.
There might be, there could be, but there isn't.  It is too easy to
edit /etc/hostname.

Bob

Attachment: pgpu4yCsQu1Q6.pgp
Description: PGP signature


Reply to: