LinuxQuestions.org
Visit Jeremy's Blog.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Networking
User Name
Password
Linux - Networking This forum is for any issue related to networks or networking.
Routing, network cards, OSI, etc. Anything is fair game.

Notices


Reply
  Search this Thread
Old 09-04-2004, 04:24 AM   #1
aroop
Member
 
Registered: May 2004
Location: Kolkata, India
Distribution: Red Hat 9
Posts: 50

Rep: Reputation: 15
How to change the host name?


Hi,
I have a Red Hat 9 Linux box, and I want to change the host name of this machine. Can someone tell me how can this be done?

Thanks,
Aroop
 
Old 09-04-2004, 04:31 AM   #2
ppuru
Senior Member
 
Registered: Mar 2003
Location: Beautiful BC
Distribution: RedHat & clones, Slackware, SuSE, OpenBSD
Posts: 1,791

Rep: Reputation: 50
several ways

you can edit /etc/sysconfig/network and change HOSTNAME=

echo newhostname >/proc/sys/kernel/hostname

hostname newhostname
 
Old 09-04-2004, 07:26 AM   #3
Hamsjael
Member
 
Registered: Aug 2003
Location: Vejle, Denmark
Distribution: Mainly Debian, some Fedora for the bleeding edge fix
Posts: 92

Rep: Reputation: 15
by far the easiest is to make a file called /etc/hostname containing your hostname for example "mymachine"

then make a file /etc/domainname containing your dns domain name for example "isp.com".
the changes should take effect immediately
 
Old 09-04-2004, 11:18 AM   #4
Oliv'
Senior Member
 
Registered: Jan 2004
Location: Montpellier (France)
Distribution: Gentoo
Posts: 1,014

Rep: Reputation: 36
Hi,

there's also a command named "hostname"

Oliv'
 
Old 09-04-2004, 12:10 PM   #5
aroop
Member
 
Registered: May 2004
Location: Kolkata, India
Distribution: Red Hat 9
Posts: 50

Original Poster
Rep: Reputation: 15
Oliv, the command hostname only changes the host name temporarily, it wont save it on next reboot. I was looking for a permanent solution!!
Thanks anyway.
 
Old 09-04-2004, 12:14 PM   #6
ppuru
Senior Member
 
Registered: Mar 2003
Location: Beautiful BC
Distribution: RedHat & clones, Slackware, SuSE, OpenBSD
Posts: 1,791

Rep: Reputation: 50
repeating myself ....

when you modify HOSTNAME value in /etc/sysconfig/network, this change is permanent.

when you write it to the proc file, the change is immediate but not permanent.
 
Old 09-04-2004, 12:18 PM   #7
aroop
Member
 
Registered: May 2004
Location: Kolkata, India
Distribution: Red Hat 9
Posts: 50

Original Poster
Rep: Reputation: 15
Hi ppuru,
I had applied your solution and got permanent results! Thanks.
 
Old 09-07-2004, 02:36 PM   #8
Oliv'
Senior Member
 
Registered: Jan 2004
Location: Montpellier (France)
Distribution: Gentoo
Posts: 1,014

Rep: Reputation: 36
Quote:
the command hostname only changes the host name temporarily
Yes that's true... except if you put this command in a boot script

Oliv'
 
Old 09-12-2004, 08:29 PM   #9
itchy
LQ Newbie
 
Registered: Sep 2004
Location: Salamanca, Spain
Distribution: Debian
Posts: 1

Rep: Reputation: 0
Question and... in Debian?

How I can change the hostname in a Debian system?

This modification affect to the system configuration (local mail, etc.) or the changes are automatically detected?

Thanks a lot

Last edited by itchy; 09-12-2004 at 09:43 PM.
 
  


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 Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
How do I change Host Name intels_ss Linux - Newbie 4 07-25-2005 07:26 PM
how to change host name? gobi_dgm Linux - Newbie 6 05-01-2005 12:34 AM
how do i change my host name? jsmarshall85 Debian 7 10-19-2004 03:04 PM
How can I change the host name? Kramer Linux - General 7 01-15-2004 08:25 AM
how do you change the host name? Culbert Linux - Software 3 03-15-2003 12:09 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - Networking

All times are GMT -5. The time now is 10:20 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