Changing host names on Unix is surprisingly complicated and implementation-specific. Even though there is a “hostname” command in most (all?) Unices, it generally doesn’t change everything.
After recently renaming an OpenBSD system, I thought I’d make a quick howto. In this example, I’ll change a server the new name cthulhu.example.com.
First, use the hostname command:
# hostname cthulhu.example.com
Next modify /etc/myname to have the same information:
# cat /etc/myname cthulhu.example.com
Update /etc/hosts, replacing the old hostname with the new.
Finally replace the host keys:
# cd /etc/ssh # rm -f *_key *.pub # ssh-keygen -A
And that’s it for the base system. Consider other software you might have installed such as mail, etc.
Related Posts:
- Hetzner Terminates Kiwix With Extreme Prejudice – What Do You Think? - December 11, 2024
- Die Hard is the Greatest Christmas Movie Ever!Learn a Little Computer Trivia from the Film and Get Bonus Entries in RackNerd’s Holiday Giveaway! - December 10, 2024
- I Can’t Believe I Bought So Many VPSes on Black Friday (How to Dig Yourself Out) - December 9, 2024
I’m confused about a few things and haven’t made this change yet. Can you share a more detailed cover letter?