Ubuntu – Two machines on the network with the same hostname

hostnameUbuntu

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 🙂

Best Answer

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