Package: manpages
Version: 3.05-1
Severity: minor
Tags: patch

The hostname(1) manual page is needlessly obtuse when it comes to
Fully Qualified Domain Names.  For example, the introductory sentence
to the FQDN section states,

 You  can't  change the FQDN (as returned by hostname --fqdn) or the DNS
 domain name (as returned by dnsdomainname) with this command.

That sentence is easily proven false:

 # dnsdomainname
 wongs.net
 # hostname foo.homeunix.org
 # dnsdomainname
 homeunix.org

More likely, the author meant that using 'hostname' is not the
*correct* way to change the domain name and that using it that way
might cause random breakage.

There are many tutorials on the Internet which actually tell people to
do the opposite, by putting the FQDN in /etc/hostname.  I believe the
man page is correct and the tutorials are incorrect, but the man page
should explain why it's wrong and how to correctly set the FQDN.

I have attached, as a patch to the man page, an example of the
"correct" way to set the FQDN. I have also corrected other small
errors, such as the part which says that /etc/hosts and /etc/hostname
should "only contain domain name".


-- System Information:
Debian Release: 5.0.3
 APT prefers stable
 APT policy: (500, 'stable')
Architecture: i386 (i586)

Kernel: Linux 2.6.26-2-486
Locale: LANG=en_US.UTF-8, LC_CTYPE=en_US.UTF-8 (charmap=UTF-8)
Shell: /bin/sh linked to /bin/bash

manpages depends on no packages.

manpages recommends no packages.

Versions of packages manpages suggests:
ii  man-db [man-browser]          2.5.2-4    on-line manual pager

-- no debconf information
--- hostname.1.orig     2007-12-27 03:47:48.000000000 -0800
+++ hostname.1  2010-02-08 05:19:06.000000000 -0800
@@ -85,24 +85,40 @@
 .IR /etc/hostname ).

 .SS THE FQDN
-You can't change the FQDN (as returned by
-.BR "hostname \-\-fqdn" )
-or the DNS domain name (as returned by
-.BR "dnsdomainname" )
-with this command. The FQDN of the system is the name that the
+The FQDN (Fully Qualified Domain Name) of the system is the name that the
 .BR resolver (3)
-returns for the host name.
+returns for the host name, such as,
+.IR ursula.example.com .
+It is usually the hostname followed by the DNS domain name (the part
+after the first dot).  You can check the FQDN using
+.B "hostname \-\-fqdn"
+or the domain name using
+.BR "dnsdomainname" .
+.LP
+You should not attempt to change the FQDN with
+.B hostname
+or
+.BR dnsdomainname .
+.LP
+The recommended method of setting the FQDN is to make the hostname be
+an alias for the fully qualified name using
+.IR /etc/hosts ,
+DNS, or NIS. For example, if the hostname was "ursula", one might have a line in
+.I /etc/hosts
+which reads
+.LP
+.RS
+127.0.1.1    ursula.example.com ursula
+.RE
 .LP
 Technically: The FQDN is the name
-.BR gethostbyname (2)
-returns for the host name returned by
+.BR gethostbyname (3)
+returns when given the host name returned by
 .BR gethostname (2).
-The DNS domain name is the part after the first dot.
-.LP
-Therefore it depends on the configuration (usually in
+Therefore it depends on the configuration of the resolver (usually in
 .IR /etc/host.conf )
-how you can change it. Usually (if the hosts file is parsed before DNS or
-NIS) you can change it in
+how you can change it. Usually the hosts file is parsed before DNS or
+NIS, so it is most common to change the FQDN in
 .IR /etc/hosts .

 .SH OPTIONS
@@ -158,9 +174,12 @@
 option in
 .BR /etc/resolv.conf .
 .SH FILES
-.B /etc/hosts
 .B /etc/hostname
-This file should only contain domain name and not the full FQDN.
+This file should only contain the host name, not the domain name. It is read at boot time by the system initialization scripts to set the hostname.
+.LP
+.B /etc/hosts
+Usually, this is where one sets the domain name by aliasing the host name to the FQDN.
+
 .SH AUTHORS
 Peter Tobias, <tob...@et-inf.fho-emden.de>
 .br

Reply via email to