LinuxQuestions.org
Visit Jeremy's Blog.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie
User Name
Password
Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question? If it is not in the man pages or the how-to's this is the place!

Notices


Reply
  Search this Thread
Old 01-19-2006, 10:12 AM   #1
mr_coffee
Member
 
Registered: Jan 2006
Location: PA
Distribution: Mandriva Power Pack 2006
Posts: 146

Rep: Reputation: 15
How can i change my machines name?


Hello everyone right now when i got into a terminal my machine name is huge, its like: x1-6-11-29-8c-c5-92
is there a way to change the name?
 
Old 01-19-2006, 10:27 AM   #2
nx5000
Senior Member
 
Registered: Sep 2005
Location: Out
Posts: 3,307

Rep: Reputation: 55
Change it in /etc/hosts to <new_hostname>
then type, as root
hostname <new_hostname>
restart X by pressing ctrl alt del

should be enough
 
Old 01-19-2006, 10:30 AM   #3
morrolan
Member
 
Registered: Sep 2003
Location: Manchester UK
Posts: 264

Rep: Reputation: 30
Your machines name is stored in something like /etc/hostname (or you can certainly view it there)

In Ubuntu (Hoary) and I believe all latest versions of Gnome, you can do it simply by going to:

System -> Administration -> Networking > Network settings
General Tab -> Host Settings -> Hostname: Specify the computer name
Save and close all opened applications, Reboot computer.

Don't know about KDE I'm afraid.

Hope that helps.

Last edited by morrolan; 01-19-2006 at 10:31 AM.
 
Old 01-19-2006, 10:44 AM   #4
mr_coffee
Member
 
Registered: Jan 2006
Location: PA
Distribution: Mandriva Power Pack 2006
Posts: 146

Original Poster
Rep: Reputation: 15
Thanks guys:
Quote:
Change it in /etc/hosts to <new_hostname>
then type, as root
hostname <new_hostname>
restart X by pressing ctrl alt del
i'm in: /etc
and i see a host.conf and a hosts but i'm not sure how i am supppose to open the host.conf if thats the file ur talking about. is hosts also a file i csan edit? i thought it was a directory but its not blue so i guess not! I'm new to command line and linux all together, any tips? thanks!

Last edited by mr_coffee; 01-19-2006 at 10:45 AM.
 
Old 01-19-2006, 10:57 AM   #5
morrolan
Member
 
Registered: Sep 2003
Location: Manchester UK
Posts: 264

Rep: Reputation: 30
OK, the easy way to determine what kind of file a file is, type:

file <filename>

at the prompt, such as "file hosts" without the quotes, and it should return the format. Usually in /etc this will be "ascii text".

you can edit this (as root - type "su" and then root password) with a command such as "gedit hosts" in GNOME, or you can use Kate in KDE.

You can also use vi, but that isn't the most user-friendly editor.

Follow these instructions to use vi:

Code:
$  su
Password:          (enter root password here)
#  file hosts
ascii text
#  cp hosts hosts.BACKUP
#  vi hosts
This will open up a command line editor called vi - follow these key presses carefully:

Press ESC once.
Press I - Something like --Insert-- should appear the the bottom of the screen.
Use the cursors to move towards the current hostname. Use backspace to remove, and type your new hostname.
Press ESC twice.
type: ":x" without quotes and press enter. That will now save the file.

That is how to edit - I am not sure if this is where you need to edit the hostname, but have faith in nx5000 and let us know if you succeed!

Last edited by morrolan; 01-19-2006 at 10:58 AM.
 
Old 01-19-2006, 10:59 AM   #6
nx5000
Senior Member
 
Registered: Sep 2005
Location: Out
Posts: 3,307

Rep: Reputation: 55
If you are on Gnome, use the tip posted before

In KDE I think its not possible?!

By hand:
Not host.conf!!

I think the previous poster was right:

Edit /etc/hostname, find your prefered editor (kwrite?)

Edit /etc/hosts

hostname <new_hostname>

You have to be root for doing these 3 (use su to switch to root)

And then you should restart x (ctrl alt-backspace and not ctrl alt del as I said lol)
Good luck
 
Old 01-19-2006, 11:01 AM   #7
nx5000
Senior Member
 
Registered: Sep 2005
Location: Out
Posts: 3,307

Rep: Reputation: 55
Quote:
Originally Posted by morrolan
but have faith in nx5000 and let us know if you succeed!
You should not
 
Old 01-19-2006, 11:09 AM   #8
morrolan
Member
 
Registered: Sep 2003
Location: Manchester UK
Posts: 264

Rep: Reputation: 30
I was thinking of saying something along those lines myself, but didn't want to offend
 
Old 01-19-2006, 07:43 PM   #9
mr_coffee
Member
 
Registered: Jan 2006
Location: PA
Distribution: Mandriva Power Pack 2006
Posts: 146

Original Poster
Rep: Reputation: 15
hey guys, thanks for the responce, i kate hosts and in the text file i see the following:
127.0.0.1 localhost

so i added the following:
hostname House

because my user name is coffee, so then in the console it will be coffee@House hah yeah thats how retarded i am.
But when i go to save it says cannot
The document could not be saved, as it was not possible to write to file:///etc/hosts.
Check that you have write access to this file or that enough disk space is available.

but i am super user, i did the su
password:

then i was root!

n/m, i must not have been hah, okay i will see if this is going to work now!

Last edited by mr_coffee; 01-19-2006 at 07:46 PM.
 
Old 01-19-2006, 07:51 PM   #10
mr_coffee
Member
 
Registered: Jan 2006
Location: PA
Distribution: Mandriva Power Pack 2006
Posts: 146

Original Poster
Rep: Reputation: 15
Crap on a crap cracker. Still the same machine name, so now in the hosts file its:
127.0.0.1 localhost
hostname House

i remember awhile back when i use to have mandrake like 8.2, it would always say like <name>@localhost so i just change localhost to the name i want? like:

127.0.0.1 House

if House is the machine name i want
 
Old 01-19-2006, 08:54 PM   #11
homey
Senior Member
 
Registered: Oct 2003
Posts: 3,057

Rep: Reputation: 59
This is one of those thingies where the command as shown in man hostname should be something like this...
hostname [-v] [-F filename] [--file filename] [hostname]

hostname -F /etc/hosts mudd.mydomain.com

Doesn't work for me in Fedora and Mandriva is Redhat based so, it likely won't work there either.

In Redhat/Fedora, you could use the gui tool system-config-network but, I don't see that in PCLinuxOS/Mandriva .

The following does work and you can get a more detailed instruction at http://mandriva.vmlinuz.ca/index.php...min/Networking .

Edit /etc/sysconfig/network
Code:
NETWORKING=yes
HOSTNAME=mudd.mydomain.com
Edit /etc/hosts
Code:
# Do not remove the following line, or various programs
# that require network functionality will fail.
127.0.0.1	localhost.localdomain	localhost
192.168.0.5	mudd.mydomain.com	mudd
Restart a bunch of things like network, dm ...
May be just as easy to restart the machine.
 
Old 01-19-2006, 09:16 PM   #12
mr_coffee
Member
 
Registered: Jan 2006
Location: PA
Distribution: Mandriva Power Pack 2006
Posts: 146

Original Poster
Rep: Reputation: 15
thanks for the responce but i don't seeem to have a /etc/sysconfig/network directory
 
Old 01-19-2006, 09:23 PM   #13
homey
Senior Member
 
Registered: Oct 2003
Posts: 3,057

Rep: Reputation: 59
The directory is /etc/sysconfig and network is a file in that directory.


cat /etc/sysconfig/network
NETWORKING=yes
HOSTNAME=mudd.mydomain.com
 
Old 01-19-2006, 11:38 PM   #14
DanTaylor
Member
 
Registered: Jan 2006
Distribution: Debian Sarge
Posts: 265

Rep: Reputation: 30
Depending on your KDE version there should just be an option in the control center
 
Old 01-20-2006, 12:42 AM   #15
jschiwal
LQ Guru
 
Registered: Aug 2001
Location: Fargo, ND
Distribution: SuSE AMD64
Posts: 15,733

Rep: Reputation: 671Reputation: 671Reputation: 671Reputation: 671Reputation: 671Reputation: 671
There is a command that you can run as root called "hostname" that allows you to change the hostname. Typed alone, it returns with your hostname.

Remember to log out of KDE after changing the hostname.
 
  


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
old machines joe6pack Linux - General 2 03-18-2005 07:56 AM
Cannot Change GNOME Menu Items to add/change Item for Mozilla 1.2 After Upgrade metoome General 0 03-27-2004 12:19 AM
Cannot Change GNOME Menu Items to add/change Item for Mozilla 1.3 After Upgrade SForsgren Linux - General 4 03-26-2004 11:43 PM
can't see other machines but they can see each other Silly22 Linux - Networking 1 11-20-2002 03:28 AM
Can't see other machines AtomicToad Linux - Networking 7 11-19-2002 08:00 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie

All times are GMT -5. The time now is 07:39 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
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration