LinuxQuestions.org
Help answer threads with 0 replies.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Distributions > Slackware
User Name
Password
Slackware This Forum is for the discussion of Slackware Linux.

Notices


Reply
  Search this Thread
Old 06-30-2002, 08:29 PM   #1
KrazyKid
LQ Newbie
 
Registered: Jun 2002
Location: Northern, NJ
Distribution: Slackware
Posts: 20

Rep: Reputation: 0
Talking Changing the hostname.


How do I change the hostname on my linux box from the default one. I am running Slack.

---------------------------------------------------------------------------------

Thx ,

KrazyKid.
 
Old 06-30-2002, 08:39 PM   #2
crabboy
Senior Member
 
Registered: Feb 2001
Location: Atlanta, GA
Distribution: Slackware
Posts: 1,821

Rep: Reputation: 121Reputation: 121
Change the hostname stored in the /etc/HOSTNAME file.

If you want to setup the hostname as well as other network properties, you can use the 'netconfig' script.
 
Old 06-30-2002, 08:41 PM   #3
trickykid
LQ Guru
 
Registered: Jan 2001
Posts: 24,149

Rep: Reputation: 270Reputation: 270Reputation: 270
hostname name-of-host-that-you-want

ahh.. crabboy beat me.. i never get beaten..

Last edited by trickykid; 06-30-2002 at 08:42 PM.
 
Old 06-30-2002, 08:57 PM   #4
SlCKB0Y
Member
 
Registered: Oct 2001
Location: Sydney
Distribution: Arch
Posts: 295

Rep: Reputation: 96
ummm, this is a dumb way to do it unless you also change /etc/hosts, lots of things will start not to work, but nice try guys.

Why not run hostname from the command line and it will change it all for you???

simple
 
Old 06-30-2002, 09:02 PM   #5
trickykid
LQ Guru
 
Registered: Jan 2001
Posts: 24,149

Rep: Reputation: 270Reputation: 270Reputation: 270
Actually that is what I mentioned.. just use the hostname command.. and come to think of it, the netconfig script will make the updates as well, but unfortunately there is no /etc/hostname file.. at least my Slack boxes don't have that file, never did either..

that's funny and just notice, everyone's reply in this thread either ends with boy or kid..

Last edited by trickykid; 06-30-2002 at 09:04 PM.
 
Old 06-30-2002, 09:36 PM   #6
KrazyKid
LQ Newbie
 
Registered: Jun 2002
Location: Northern, NJ
Distribution: Slackware
Posts: 20

Original Poster
Rep: Reputation: 0
Thx all for your help with my system.
 
Old 06-30-2002, 09:56 PM   #7
Excalibur
Senior Member
 
Registered: Jun 2002
Location: Northern VA, USA
Distribution: Ubuntu
Posts: 1,180

Rep: Reputation: 46
Well, can somebody else get in on the fun here?

Actually the proper method is to use /sbin/netconfig that was suggested earlier. If the machine is networked then it is also the best here because the machine is still using the default name of darkstar.example.net then it has not been run at all. If not, then manually changing a file is OK.

The netconfig script writes/creates several files.

/etc/HOSTNAME (note: the uppercase)
/etc/networks
/etc/resolv.conf
/etc/hosts
/etc/rc.d/rc.inet1

That is all that I can recall at the moment. HOSTNAME is the only file that doesn't pertain to networking other than it contains the fully qualified domain name for the others to use.

To change the hostname manually without the networking parts. Modify the /etc/HOSTNAME to contain the name desired and then run the command

hostname new-host-name

If the HOSTNAME file is not modified then it will revert back on the next boot because it will be read by /etc/rc.M script. To my knowledge the hostname command does not modify any files.

If the machine is networked then the /etc/hosts file must also be updated manually.

In one way or another you were all right. Please feel free to correct anything that I may be amiss.

Cheers
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

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
changing hostname sh4d0w13 Debian 4 06-14-2005 10:45 AM
hostname changing rusty_slacker Linux - General 2 04-15-2005 06:49 PM
Changing hostname? Alf829 Linux - Networking 2 03-08-2004 08:31 AM
Hostname changing Neorio Linux - Networking 2 01-03-2004 07:11 PM
Changing hostname tristan2600 Linux - Newbie 1 10-17-2003 08:18 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - Distributions > Slackware

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