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

Re: "hostname" question during Debian installation

On Wed, Feb 15, 2012 at 2:12 AM, Bob Proulx <bob@proulx.com> wrote:
> Martin T wrote:

>> thank you for replies! So am I correct, that hostname set during the
>> installation is:

You're welcome.

>> 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
> unplugged.
> 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.


"libnss-myhostname" provides the same functionality as adding the
"" line in "/etc/hosts".

>> 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.

When you use "dpkg-reconfigure exim4-config" or "dpkg-reconfigure
postfix", "/etc/mailname" is updated; in postfix's case because "my
origin" is set to it in "/etc/postfix/main.cf".

Mutt also uses it but it can be overridden by "~/.muttrc".

>> 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.

"/etc/motd" is a symlink to "/var/run/motd", which is generated at
boot by "/etc/init.d/bootlogs" and contains the output "uname -snrvm",
so "/etc/motd" does contain a box's hostname.

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

Like "/etc/issue" (where the hostname's set by "/n"), the hostname in
the prompt's set
 by "\h" so it's changed dynamically at boot.

Reply to: