LinuxQuestions.org
Download your favorite Linux distribution at LQ ISO.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - General
User Name
Password
Linux - General This Linux forum is for general Linux questions and discussion.
If it is Linux Related and doesn't seem to fit in any other forum then this is the place.

Notices


Reply
  Search this Thread
Old 03-17-2003, 03:05 AM   #1
correro
Member
 
Registered: Oct 2002
Distribution: RedHat 8.0
Posts: 140

Rep: Reputation: 15
Where is "/etc/HOSTNAME"?


I remember there was "/etc/HOSTNAME" in RedHat 7.x, in which the hostname is specified. But I did not find this file in RedHat 8.0

Does RH8 rely on another file for hostname? What is that file?
 
Old 03-17-2003, 03:14 AM   #2
doublefailure
Member
 
Registered: Mar 2002
Location: ma
Distribution: slackware
Posts: 747

Rep: Reputation: 30
i don't use redhat8
but prolly changing /etc/hosts would work
add
127.0.0.1 yourhostname.abc.com yourhostname

u can change abc.com whatever u like or put your actual dns if u have one
 
Old 03-17-2003, 03:25 AM   #3
correro
Member
 
Registered: Oct 2002
Distribution: RedHat 8.0
Posts: 140

Original Poster
Rep: Reputation: 15
"/etc/hosts" is supposed to be read by "named".

If "named" is not running locally, how would the system know what the local hostname is?
 
Old 03-17-2003, 03:31 AM   #4
acid_kewpie
Moderator
 
Registered: Jun 2001
Location: UK
Distribution: Gentoo, RHEL, Fedora, Centos
Posts: 43,417

Rep: Reputation: 1985Reputation: 1985Reputation: 1985Reputation: 1985Reputation: 1985Reputation: 1985Reputation: 1985Reputation: 1985Reputation: 1985Reputation: 1985Reputation: 1985
/etc/hosts is not for named, it's for everythign that wants to resolve a host name

the acutal hostname file is normally in /etc/sysconfig/hostname afaik
 
Old 03-17-2003, 03:46 AM   #5
correro
Member
 
Registered: Oct 2002
Distribution: RedHat 8.0
Posts: 140

Original Poster
Rep: Reputation: 15
But I didn't fine "hostname" in "/etc/sysconfig/". Are you sure it should be sitting there? And "/etc/HOSTNAME" no longer exists in RH8?
 
Old 03-17-2003, 06:54 AM   #6
michaelk
Moderator
 
Registered: Aug 2002
Posts: 25,704

Rep: Reputation: 5897Reputation: 5897Reputation: 5897Reputation: 5897Reputation: 5897Reputation: 5897Reputation: 5897Reputation: 5897Reputation: 5897Reputation: 5897Reputation: 5897
The actual file name is called network located in the /etc/sysconfig folder. Change the hostname= line.

The command hostname will display or change the PC hostname.
 
Old 03-17-2003, 02:44 PM   #7
nakkaya
LQ Guru
 
Registered: Jan 2003
Location: Turkey&USA
Distribution: Emacs and linux is its device driver(Slackware,redhat)
Posts: 1,398

Rep: Reputation: 45
/etc/HOSTNAME is /etc/hosts thats where u configure your hostname
 
Old 03-17-2003, 09:51 PM   #8
correro
Member
 
Registered: Oct 2002
Distribution: RedHat 8.0
Posts: 140

Original Poster
Rep: Reputation: 15
So there are "/etc/hosts" and "/etc/sysconfig/network", in both of which I can modify the hostname. Is this correct?

What would be the safe way to do this without causing problems to hostname-related services (like sendmail, etc.)?
 
Old 03-18-2003, 09:54 AM   #9
Unseen
Member
 
Registered: Feb 2003
Distribution: debian
Posts: 56

Rep: Reputation: 15
I just changed my /etc/sysconfig/network file to reflect my desired hostname. This changed it effectively for everything... I don't have sendmail running on this particular machine, so I couldn't answer that particular question...
 
Old 03-18-2003, 07:10 PM   #10
correro
Member
 
Registered: Oct 2002
Distribution: RedHat 8.0
Posts: 140

Original Poster
Rep: Reputation: 15
will the files keep consistent automatically?

that is, if you specify hostname in "/etc/hosts", it will be reflected in "/etc/sysconfig/network", and vice versa. is this correct?
 
Old 03-18-2003, 07:17 PM   #11
rmartine
Member
 
Registered: Dec 2002
Location: San Luis Obispo, CA
Distribution: Fedora Core 3
Posts: 618

Rep: Reputation: 30
THANK YOU CORRERO!!! I had been pulling my hair out forever trying to change the hostname. I tried chasing the script files around to see who sets or checks the HOSTNAME var but I couldn't find it. Freaking RedHat moved it. I used to just change the value in /etc/HOSTNAME.

On another note, changing the HOSTNAME in /etc/sysconfig/network did not change /etc/hosts. Mine still says localhost.localdomain. Should I change that also to be consistent??

Thanks again

Last edited by rmartine; 03-18-2003 at 07:25 PM.
 
Old 03-18-2003, 07:26 PM   #12
correro
Member
 
Registered: Oct 2002
Distribution: RedHat 8.0
Posts: 140

Original Poster
Rep: Reputation: 15
you know what, i'm always the one who asks questions. this is the first time that someone thanked me for my posts

now i understand why there're so many helping hands around here
 
Old 03-18-2003, 08:17 PM   #13
rmartine
Member
 
Registered: Dec 2002
Location: San Luis Obispo, CA
Distribution: Fedora Core 3
Posts: 618

Rep: Reputation: 30
 
Old 03-19-2003, 03:51 PM   #14
Itzac
Member
 
Registered: Feb 2003
Distribution: VectorLinux 5.1
Posts: 116

Rep: Reputation: 15
changing /etc/sysconfig/network will change your hostname at next boot time, but some programs will use /etc/hosts, so you have to change that too.

/etc/hosts is really a legacy thing from before DNS. If you want you can alias servers you acces regularly in that file.

Later all,
 
  


Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
SSH: how to disable "hostname reverse checking"? Alik_2005 Linux - Security 1 02-24-2005 09:25 AM
FC2 freezes on boot "setting hostname" munkymonkjr Fedora 2 10-03-2004 10:07 PM
RH 9, Netz und DNS Config, Fehler "set visible hostname" j.kopitzke Linux - Newbie 0 06-18-2003 11:31 PM
/var/log/messages contains "localhost" instead of the real hostname allel Linux - Networking 0 07-15-2002 02:49 PM
Can't print due to "bad hostname" vortech Linux - Newbie 1 12-17-2001 04:42 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - General

All times are GMT -5. The time now is 10:25 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration