Changing Host name

Robert A. Klahn plug-discuss@lists.plug.mybutt.net
Sun, 20 Jan 2002 19:56:08 -0700


Greetings:

In RedHat (at least 7.2), the hostname is in /etc/sysconfig/network. You will need a line in that file like this:

HOSTNAME=george

Replacing "george", of course, with your hostname, unless, of course, you name your machine after Curious George too! :) The setting in this file can also be edited with the "Network Configuration" GUI which is found, at least for those of use who use Gnome, on the Programs -> System -> Network Configuration menu entry, under the "DNS" (not hosts, where you might expect to find it) tab.

Speaking of the hosts file, its also good if you have an entry for your hostname in /etc/hosts. You can set this under the same Network Configuration GUI, or you can manualy edit /etc/hosts. I have a line like:

127.0.0.1	localhost	george

And I seem to get away with binding this name to the localhost interface. I would expect some programs to expect your hostname to resolve to a non-loopback interface, but I have not run into one yet.

BTW, the setting in /etc/sysconfig/network only affects the hostname that is set at boottime. If you want to change your hostname on the fly, you can do a:

/bin/hostname george

Hope this helps.

Bob.

On Sun, 20 Jan 2002 19:50:43 -0700
"Tom Achtenberg" <tom@ybnormal.org> wrote:

> I've been trying with no luck to figure out where to change the hostname for my RH 7.2 Linux box.  I get a bad hostname error whenever I boot when trying to start lpd service.  Whenever I try to print to one of my network printers I get a box that simply says "There was an error trying to send to the printer."  I used an editor to look in /bin/hostname but the only line there is compiled and not text.
> 
> 
> Tom Achtenberg
> 
> Visit my home page at http://achtenberg.com
> 
> 


-- 
Robert A. Klahn
rklahn@acm.org

"Hope has two beautiful daughters: Anger and Courage. Anger at the way
things are, and Courage to struggle to create things as they should be." -
St. Augustine