Logo 
Search:

Unix / Linux / Ubuntu Forum

Ask Question   UnAnswered
Home » Forum » Unix / Linux / Ubuntu       RSS Feeds

Where is the file to permantly change the hostname of my machine

  Date: Nov 24    Category: Unix / Linux / Ubuntu    Views: 452
  

where is the file to permantly change the hostname of
my machine? typing "hostname newhost" and then
rebooting the machine will rename it to the old
hostname.

Share: 

 

7 Answers Found

 
Answer #1    Answered On: Nov 24    

it is a live server?????????????

 
Answer #2    Answered On: Nov 24    

I had a similar problem quite some time ago. I traced through the boot
scripts and found the /etc/sysconfig/network file to be the culprit.

1. Change to the superuser.
2. Change the /etc/sysconfig/network (assumeing Mandrake) file to
reflect the correct hostname information. This is the file that sets
things on startup.
3. Use the hostname command to change the hostname while the system is
running. No reboot required. Just make sure they match and everything
should be cool.

The syntax looks like this:

hostname my.hostname.com

 
Answer #3    Answered On: Nov 24    

/etc/hosts
per manpage............

 
Answer #4    Answered On: Nov 24    

Yeah, I read the man page and set that value in the
/etc/hosts file, but it still resets it. Does the
network dns server need to have an entry for it?
(meaning the dns server for the private network)

 
Answer #5    Answered On: Nov 24    

Actually, assumeing a Mandrake system, /etc/sysconfig/network is probably what you are looking for.
The /etc/hosts file is not used to actually set the hostname on startup. Rather it is used as a handy substitute for DNS.

 
Answer #6    Answered On: Nov 24    

If you're running a live server, you should at least know how to change
your hostname. Shutdown the server, and read some manuals.

 
Answer #7    Answered On: Nov 24    

This can be complicated really, and it depends on your Linux
distribution. For example, Slackware automatically rewrites
/etc/hostname as the default from one of the /etc/rc.d/ files on
startup. the hostname is always stored in /etc/hostname, but grep
/etc/rc.d for /etc/hostname just to make sure your system isn't
overwriting /etc/hostname.

You don't need to reboot your machine, but you might want to restart all
your network daemons.

 




Tagged: