Red Hat axp-list: Linux on Alpha (1995-2022)
 help / color / mirror / Atom feed
From: Michal Jaegermann <michal@ellpspace.math.ualberta.ca>
To: axp-list@redhat.com
Subject: Re: constantly changing /etc/HOSTNAME file
Date: Sun, 27 Dec 1998 16:47:59 -0700 (MST)	[thread overview]
Message-ID: <199812272347.QAA12113@ellpspace.math.ualberta.ca> (raw)
In-Reply-To: <3686AB0E.B110A418@infinet.com> from "jmd" at Dec 27, 98 09:47:58 pm

jmd wrote:
> 
> > Even if you are using DHCP it is hard to imagine that your ISP is that
> > "smart" that it rewrites your sysconfig files. 
> 
> I don't think the ISP is writing to this file. I think there is
> something internally wrong with my set up. 

Probably not. :-)

> /etc/sysconfig/network is:
> 
> NETWORKING=YES
> FORWARD_IPV4=NO
> HOSTNAME=localhost.localdomain
                   ^^^^^^
              Hm, I would put something here; even if only for
              an "internal" use. 

> GATEWAYDEV=
> GATEWAY=
> 
> /etc/rc.d/rc.sysinit includes the lines:
> 
> if [ -f /etc/sysconfig/network ]; then
> 	. /etc/sysconfig/network
> 
> else
> 	NETWORKING=no
> 	HOSTNAME=localhost

More important are lines below:

# Set the hostname.
hostname ${HOSTNAME}
echo hostname: `hostname`


> This is what happens:
> I boot clean with "localhost.localdomain" in my /etc/HOSTNAME file.
> If I dial in to my ISP this file (etc/HOSTNAME) is changed as soon as I
> am logged in the ISP and have been assigned an IP address. (example
> a021.pm3-1.nwk.infinet.com)

The above seems to mean that you are using DHCP protocol to lease
IP address and a name under which you are visible "outside".

> Taking that example if I open /etc/HOSTNAME after I log in to the ISP
> the file will read "a021.pm3-1.nwk.infinet.com" localhost.localdomain
> will not be in this file.

DHCP client writes a few files (like resolv.conf) usually in a private
directory, like /etc/dhcp/, and executes a setup script.  It sounds
like this scripts overwrites your /etc/HOSTNAME file (which is not very
significant on its own anyway) with something probably from /etc/dhcp/.
Apparently it also performs some other actions.  Why you would like to
have in /etc/HOSTNAME somethings like localhost.localdomain is beyond
my comprehension.

> If I open another terminal with ctl-alt-F2 then the login prompt will
> be:
> [jmd@a021 jmd]$

Prompt is set in your shell startup files (this depends on your login
shell - but assuming that this is bash these will be /etc/profile,
/etc/bashrc, ~/.bash_profile and ~/.bashrc).  You will see there
something like 'PS1=.....' and /etc/HOSTNAME is not consulted in the
process unless you make it to;  check for yourself by changing
a contents of /etc/HOSTNAME and opening new shell.  BTW - I think that
a default prompt in Red Hat configuration is very bad choice.
You will find that pretty soon if you will try to check something
in your various 'bin' subdirectories.  Not a very big deal as you can
change that any way you want.

> 
> I changed the permissions for /etc/HOSTNAME to 444 and it still wrote to
> the file.

Not wrote but apparently replaced it with something else.  That is
another, not equivalent, operation.

You are still not presenting the whole story.  One has to guess what
you are really doing (dhcp and its setup).  You also claimed that
a new name shows after the next boot.  It is not clear how but your
computer is doing only what it was told to do.

   Michal


  parent reply	other threads:[~1998-12-28  0:02 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
1998-12-26 20:08 constantly changing /etc/HOSTNAME file jmd
1998-12-26 20:32 ` Michal Jaegermann
1998-12-27 21:47   ` jmd
1998-12-27 22:06     ` Tristan Colgate
1998-12-27 22:40     ` Paul Tomblin
1998-12-29 17:00       ` Maurice Hilarius
1998-12-27 23:47     ` Michal Jaegermann [this message]
  -- strict thread matches above, loose matches on Subject: below --
1998-12-27 22:41 Designer 7
1998-12-27 23:24 ` Tristan Colgate
1998-12-27 23:28   ` Paul Tomblin
1998-12-28  1:56 ` jmd
1998-12-28  2:35 Designer 7
read-only archive

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox