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

Re: "hostname" question during Debian installation

Martin T wrote:
> thank you for replies! So am I correct, that hostname set during the
> installation is:
> 1) mapped to an address from range in /etc/hosts file

Specifically so that it is always available and doesn't
conflict or confuse with localhost.  The newer networking
subsystem is event driven and supports hotplug devices.  It may come
and go.  Having a local address will always exist and will
always map back to the hostname even if the main networking is

It's different from traditional systems but it solves problems
introduced by event driven hotpluggable network devices.  It allows a
system to always be able to contact itself and the reverse mapping of
the IP address back to a name always maps back to itself.

This is important on mobile devices which may be offline but is a
consistent strategy and works well on non-mobile devices too.

> 2) written to /etc/mailname

Yes.  And also to /etc/postfix/main.cf if postfix is installed.  Or to
other places if other MTAs are installed.

> 3) written to "message of the day" file

No.  The /etc/motd doesn't include the hostname.  You are thinking of
/etc/issue but it also doesn't include the hostname either.  It
may include @char and \char sequences which substitute the dynamically
hostname at runtime though.

> 4) usually used in shell prompt(for example "\[\e]0;\u@\h:
> \w\a\]${debian_chroot:+($debian_chroot)}\u@\h:\w\$")

Yes.  But lots of programs use the hostname with emphasis on "use".
But you will have a very long list if you head down that path of

> ..and this is it? Or did I miss any other uses of the "hostname"?

You missed the most important and primary use of it! :-)


The /etc/hostname is read at boot time and sets the hostname.

> For some reason I always thought that hostname is definitely used by
> at least other hosts in the LAN and local processing running in the
> server, but turns out out was wrong(?). I mean one needs to
> configure local processes(for example cupsd or snmpd) to use
> "hostname" IP address if he wants to- by default they all use
> which is mapped to "localhost" in /etc/hosts file.

For the most part only processes local to the system need to know the
hostname.  By default the system is a pure client.  If you want to
contact the host from other systems then it is convenient to register
a DNS name to ip address mapping for it so that you can refer to the
host by a hostname.  But that isn't required and neither is it set up
by default.  If you want that then you would need to set it up


Attachment: signature.asc
Description: Digital signature

Reply to: