LinuxQuestions.org
Review your favorite Linux distribution.
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
 
LinkBack Search this Thread
Old 07-06-2004, 03:20 AM   #1
fuelinjection
Member
 
Registered: Nov 2003
Location: County Durham, England
Distribution: Fedora
Posts: 238

Rep: Reputation: 30
how to change hostname


Hi All,

When I installed slackware I setup it up as localhost.localdomain.

now, by entering
'hostname sheppardweb.co.uk'
It changes my hostname, but if I reboot, it reverts back to localhost.localdomain

How can I change this permanently?

Thanks

Shaun
 
Old 07-06-2004, 03:51 AM   #2
chakkerz
Member
 
Registered: Dec 2002
Location: Brisbane, Australia
Distribution: Slackware Current, RedHat (RHEL, FC, CentOS), openSuSE, Mac OS X
Posts: 650

Rep: Reputation: 32
do it as root (you shouldn't be able to do it otherwise anyway)

edit /etc/hostname

<edit> sorry ... my bad, make that /etc/HOSTNAME (slackware)

Quote man hostname:
The host name is usually set once at system startup in /etc/rc.d/rc.inet1
or /etc/init.d/boot (normally by reading the contents of a file which
contains the host name, e.g. /etc/hostname).

<edit> and on slackware (since we're at it) it's set in /etc/rc.d/rc.M

Last edited by chakkerz; 07-06-2004 at 04:03 AM.
 
Old 07-06-2004, 08:53 AM   #3
fuelinjection
Member
 
Registered: Nov 2003
Location: County Durham, England
Distribution: Fedora
Posts: 238

Original Poster
Rep: Reputation: 30
I don't have /etc/HOSTNAME on my machine.

is there anyway I can maybe just run the command 'hostname sheppardweb.co.uk' at startup
 
Old 07-06-2004, 09:25 AM   #4
laceupboots
Member
 
Registered: Dec 2003
Location: Houston
Distribution: Windows Vista/ XP/ Mepis
Posts: 304

Rep: Reputation: 30
In /etc/rc.d/rc.sysinit about line 25, you can change the default hostname. You have to do this as root.
 
Old 07-06-2004, 09:53 AM   #5
fuelinjection
Member
 
Registered: Nov 2003
Location: County Durham, England
Distribution: Fedora
Posts: 238

Original Poster
Rep: Reputation: 30
I dont have that file, the closest thing to it is rc.sysvinit, but that doesnt really have anything usefull in it.
 
Old 07-06-2004, 12:52 PM   #6
trickykid
Guru
 
Registered: Jan 2001
Posts: 24,121

Rep: Reputation: 121Reputation: 121
Quote:
Originally posted by laceupboots
In /etc/rc.d/rc.sysinit about line 25, you can change the default hostname. You have to do this as root.
That is for Redhat or other Linux distros.

The easiest way to edit all your networking scripts which will also setup your hostname and domain would be to simpy run as root: netconfig

Or you can edit:

/etc/hostname
/etc/rc.d/rc.inet1

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
Trackbacks are Off
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
How do you change your hostname? Thaidog Linux - Newbie 6 07-24-2005 08:52 PM
Change hostname garlam Slackware 2 10-13-2004 02:19 AM
How to change hostname blackbart Linux - Newbie 2 02-01-2004 02:56 PM
change hostname dincer80 Linux - Networking 3 07-31-2003 01:30 AM
change hostname kafnir Linux - Networking 1 10-21-2002 11:10 AM


All times are GMT -5. The time now is 03:35 AM.

Main Menu
 
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
identi.ca: @linuxquestions
Facebook: @linuxquestions
Open Source Consulting | Domain Registration