Server Fault is a question and answer site for system and network administrators. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

There are two machines on my network that have the same hostname. I verified it by typing

# hostname

on the terminal. The effect is that I can only view one of the two machines on the Network, from Nautilus. One machine is Ubuntu 10.04 and the other is 9.10.

I tried

# sudo hostname newName

and restarted the machine, but the name remains the same. What should I do to change the hostname?

Thanks :)

share|improve this question
up vote 1 down vote accepted

The correct way to set hostname in ubuntu is to update the hostname file. This is true for most linux distributions.

emacs /etc/hostname 

For more information see

man hostname
share|improve this answer
also works with "vi /etc/hostname" ;-) – ascobol Nov 18 '10 at 13:47
Or ed, vim, nano, pico, or butterflies ;) +1 – pehrs Nov 18 '10 at 14:56
nano is fine for me! – theTuxRacer Nov 19 '10 at 6:13

you need to change it in:



for a perminant change

share|improve this answer
Debian-based Ubuntu does not have /etc/sysconfig/network. You're thinking of redhat/centos/fedora. – Steven Monday Nov 18 '10 at 15:20
yeah, I couldnt find the mentioned file at the location. – theTuxRacer Nov 19 '10 at 6:13

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.