HOWTO Rename a Debian system

This article was first written in December 2004 for the BeezNest technical
website (

To rename a Debian system, it is not enough to change the /etc/hostname file, you probably need to change some references to the old name elsewhere. This article tries to pinpoint the files where it would be needed to change it. Be careful, the name may also be configured in specific applications, like in some databases.

System files, where changes are mandatory

  • /etc/hostname
  • /etc/hosts
  • /etc/mailname
  • Configuration files for the MTA used

Application files, depending on the program

It is not possible to list every possible application configuration file where the name may have been hardcoded. So the simplest way to detect them is to do the following:

# rgrep -i oldname /etc/*

where oldname is the previous hostname.

And of course, don’t forget to change the name references on other machines of the network also, where it applies.

It's only fair to share...Share on FacebookShare on Google+Tweet about this on TwitterShare on LinkedInShare on TumblrEmail this to someone

Leave a Reply

Your email address will not be published. Required fields are marked *