Take the 2-minute tour ×
Server Fault is a question and answer site for professional system and network administrators. It's 100% free, no registration required.

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
add comment

2 Answers

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
1  
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
add comment

you need to change it in:

/etc/sysconfig/network

HOSTNAME="plain.domainname.com"

for a perminant change

share|improve this answer
1  
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
add comment

Your Answer

 
discard

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.