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

I want to rename one of my Debian linux servers to give it a more descriptive, role-based name.

Here are the places I know the name will need to be changed:

  • /etc/hostname & /etc/mailname & execute hostname command
  • /etc/hosts
  • /etc/hosts on other servers, such as our remote log server
  • /etc/password (I normally rename root to match the server name, makes sorting mail easier)
  • Logwatch / Logcheck configuration
  • "rkhunter --propupd" needs to be run
  • Backup client configuration - Backup Server Configuration
  • Name in heartbeat or keepalive configuration (on all cluster servers) if this is part of a cluster
  • /etc/drbd.conf (if there are shared drbd drives)
  • DNS server - both internal and external
  • Server Name in Virtual Center (this is a virtual server)
  • Name in Nagios / OpsView or other monitoring software
  • References in server documentation

What have I overlooked? Are there other common things that need to be changed when renaming a server?


locked by HopelessN00b Mar 13 '15 at 13:36

This question exists because it has historical significance, but it is not considered a good, on-topic question for this site, so please do not use it as evidence that you can ask similar questions here. This question and its answers are frozen and cannot be changed. More info: help center.

closed as primarily opinion-based by HopelessN00b Mar 13 '15 at 13:36

Many good questions generate some degree of opinion based on expert experience, but answers to this question will tend to be almost entirely based on opinions, rather than facts, references, or specific expertise.If this question can be reworded to fit the rules in the help center, please edit the question.

up vote 6 down vote accepted

A few other things to check:

  • If you run MySQL, don't forget to update it as well. By default, mysql_install_db will add entries to the mysql.user table allowing access from the server's own hostname. It usually adds localhost as well, so you're probably ok here, but it's worth doublechecking to make sure you don't lock yourself out.

  • If you're running Apache, make sure you update the ServerName globally and in any virtual hosts that may have been using the old canonical hostname.

  • If you're running a mail server (Sendmail, Postfix, etc.), make sure it can figure out its own hostname. For instance, Postfix will try to automatically fill in $myhostname, but that won't help if you've manually overridden it in /etc/postfix/

  • If this server talks to others that are set up to perform access control based on hostname (e.g. /etc/exports for NFS, /etc/hosts.allow, etc.) you will need to update those as well.

  • If you have any SSL keys using the server's old hostname as the common name (CN), you will need to recreate them using the new hostname and issue new certificate requests. Hopefully they're self-signed so you don't have to pay someone for the new certs. Strictly speaking, SSL will still work if you don't do this, but clients will usually pop a warning message about the name mismatch.

There certainly may be others depending on the applications you run.


I'd do it in a "mass grep" way. For example:

$ grep -rin "hostname" / > /my/output/file.txt

and examine file.txt when it finishes.

Reason for that being that it's nearly impossible to accurately know where hostname/ip changes are needed, even if you're on top of your config, users might configure their software to depend on it, blind search tends to avoid such trouble before it arises.


You could always just add another entry in your hosts files on other machines on the local network (if feasible) so that the machine responds to both:

[root@165 ~]# cat /etc/hosts
# Do not remove the following line, or various programs
# that require network functionality will fail.       localhost.localdomain localhost myserver myserver2 another_name yet_another

In the above example would be the local machine, would be the remote machine you are aliasing

Great point. I did this in DNS so that the old name would be around for awhile – Brent Jul 23 '09 at 15:53
It can be helpful for a machine to have its own name that never changes and additional names relating to its current purpose. Different clients and services refer to it by the most appropriate name. – mas Jul 23 '09 at 16:56

When I rename my Ubuntu hosts (happens fairly often since I clone a virtual machine regularly for different tests) I not only have to do...

sudo grep -R oldhostname /etc/*

But I also have to re-run the postfix configuration. Just editing the config files doesn't change everything thing.

sudo dpkg-reconfigure postfix

After making those changes and restarting everything is good to go.


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