From mboxrd@z Thu Jan 1 00:00:00 1970 Received: (qmail 7583 invoked from network); 28 Dec 1998 00:02:45 -0000 Received: from mail.redhat.com (199.183.24.239) by lists.redhat.com with SMTP; 28 Dec 1998 00:02:45 -0000 Received: from ellpspace.math.ualberta.ca (michal@ellpspace.math.ualberta.ca [129.128.88.19]) by mail.redhat.com (8.8.7/8.8.7) with ESMTP id SAA15994 for ; Sun, 27 Dec 1998 18:48:01 -0500 Received: (from michal@localhost) by ellpspace.math.ualberta.ca (8.8.8/8.8.8) id QAA12113 for axp-list@redhat.com; Sun, 27 Dec 1998 16:47:59 -0700 From: Michal Jaegermann Message-Id: <199812272347.QAA12113@ellpspace.math.ualberta.ca> Subject: Re: constantly changing /etc/HOSTNAME file To: axp-list@redhat.com Date: Sun, 27 Dec 1998 16:47:59 -0700 (MST) In-Reply-To: <3686AB0E.B110A418@infinet.com> from "jmd" at Dec 27, 98 09:47:58 pm Content-Type: text 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