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

/etc/hosts hostname alias



Hi,

Can someone tell me why the hostname of a machine is added as an alias
for 127.0.0.1 to /etc/hosts during the installation i.e. why do we
have something like this in /etc/hosts?

--- begin ---
127.0.0.1       localhost.localdomain   localhost       pluto
---  end  ---

With the default (and normal) /etc/nsswitch.conf, first /etc/hosts is
consulted and then DNS.

Having the hostname as alias for the localhost IP address already got
me in troubles two times:

(1) When adding a new host to a Kerberos realm. It took me quite some
    time to find out why I could not login to a newly added machine
    (using the same procedure as on my Woody boxes). Part of the
    problem was the fact that /etc/hosts contained the hostname (not
    fully qualified) as alias for 127.0.0.1.

(2) When creating a sudoers file with Host_Alias definition. Using the
    (short) hostname makes that sudo keeps asking for a password while
    it should not. Using the IP address or deleting the hostname alias
    in /etc/hosts resolves this issue.

BTW, note that the output of hostname --fqdn shows
localhost.localdomain. Deleting the alias shows the correct fully
qualified hostname.

Thus, why is the hostname added as an alias for 127.0.0.1? 

P.S.: All Sarge machines are installed using the network (PXE) so they
get their IP via DHCP. After installation however, I statically assign
their IP (BIOS first tries to boot from the network (only used to
install), then from the harddisk).


cu,

-- 
lenaerts.frank@pandora.be

gpg fingerprint: A41E A399 5160 BAB9 AEF1  58F2 B92A F4AB 9FFB 3707
gpg key id: 9FFB3707

Those who do not understand Unix are condemned to reinvent it, poorly."
-- Henry Spencer

Attachment: signature.asc
Description: Digital signature


Reply to: