1

I have a very strange problem with my hostname on Debian 7+. I've changed the hostname on my new server but for some reason it doesn't change in wierd places. Right now I get the old hostname when I login using SSH AND all my cron emails send the emails as root@old.hostname.com.

/etc/hosts has the correct new hostname (new.hostname.com)

/etc/sysconfig/network has the correct new hostname (new.hostname.com)

hostname shows the correct new hostname (new.hostname.com)

hostname -A and hostname --fqdn shows the correct new hostname (new.hostname.com)

Where else can I look to see if there's a missconfiguration somewhere?

This is the example welcome text when logging in using SSH:

login as: root
root@new.hostname.com's password:
Linux old.hostname.com 2.6.32-042stab094.7 #1 SMP Wed Oct 22 12:43:21 MSK 2014 x86_64
2
  • Did you restart your system after changing the hostname? Nov 14 '14 at 10:34
  • I can't explain this... but a reboot didn't do it but a hard server power off and power on magically made the hostname appear correct. So wierd! Thank you! Nov 14 '14 at 10:48
1

Powering the server off and then powering it on again forced it to update the hostname.

A regular reboot would probably do it as well in most cases.

2
  • Never underestimate the tenacity of a caching name server. :)
    – PM 2Ring
    Nov 14 '14 at 13:32
  • I'd love to know what service was caching the old name. I don't want to have to reboot a production server to fix the hostname. It's confusing my logging system, but it's mostly cosmetic. Highly annoying though.
    – Mnebuerquo
    May 16 '18 at 20:22

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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