On Sun, 22 Jun 2008 22:16:59 -0700 (PDT), guddu wrote:
> Hi,
> I am trying to change the host name of a linux machine.
With 300+ linux distributions, you may want to read
http://www.catb.org/~esr/faqs/smart-questions.html
Always helps to provide which distribution, version and maybe which
desktop manager you are running. Those may get you more detailed
answers to your problem.
> I have modified /etc/hosts as follows :
>
> 127.0.0.1 localhost.localdomain localhost
> ##< IP ADDRESS> <OLD HOSTNAME>
><IP ADDRESS> <NEW HOSTNAME>
>
> /etc/nsswitch.conf is modified as follows :
> #hosts: db files nisplus nis dns
> ##hosts: files nisplus dns
> hosts: files
>
>
> /etc/sysconfig/network
> ##HOSTNAME=<OLD_HOSTNAME>
> HOSTNAME=<NEW_HOSTNAME>
>
> Then I have executed these on the shell :
> hostname <new_HOSTNAME>
If /etc/sysconfig/network controls hostname then running
hostname <new_HOSTNAME>
should have no impact on next reboot. Then again, you may have just
overrode normal operation of assigning hostname during boot.
> service xinetd restart
That should have not modified anything. If /etc/sysconfig/network controls
hostname, then restarting the network might change it, might not.
Anytime I change a host name, I reboot so that all services depending
on the name will be restarted.
> Can anyone tell me what is that which I am missing here.
Not me, without know exactly which distribution you are running.
I recommend a reboot based lack of information provided.