Take the 2-minute tour ×
Unix & Linux Stack Exchange is a question and answer site for users of Linux, FreeBSD and other Un*x-like operating systems.. It's 100% free, no registration required.

During Debian installation, I set my hostname to the wrong value, and now I would like to correct that.

share|improve this question
add comment

3 Answers

up vote 11 down vote accepted

The hostname is stored in three different files:

  • /etc/hostname Used as the hostname
  • /etc/hosts Helps resolving the hostname to an IP address
  • /etc/mailname Determines the hostname the mail server identifies itself

You might want to have a deeper look with grep -ir hostname /etc

Restarting affected services might be a good idea as well.

share|improve this answer
add comment

The value is stored in /etc/hostname. After modifying, apply it with /etc/init.d/hostname start

share|improve this answer
    
This fails in Debian 6. Which version are you using? –  Tshepang Jul 27 '11 at 11:07
add comment

Various services may also depend on being able to resolve the hostname locally, which is often handled by an entry in the /etc/hosts file.

share|improve this answer
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.