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:
Let's Try BSD, Part 7 of 7: Conclusions About FreeBSD, OpenBSD, NetBSD, and DragonFlyBSD
Let's Try BSD, Part 6 of 7: Jump Into the Unknown With Me As I Install DragonFlyBSD!
Let's Try BSD, Part 5 of 7: Setting Up Nginx + WordPress on OpenBSD! Almost!
Let's Try BSD, Part 4 of 7: NetBSD, the BSD That Runs on Your Grandfather's Pocket Watch
Let's Try BSD, Part 3 of 7: FreeBSD, the Power to Serve
Let's Try BSD, Part 2 of 7: How I Setup for FreeBSD, OpenBSD, NetBSD, and DragonFlyBSD
- Let’s Encrypt Retiring Expiration Emails: Three Quick Solutions to Fill the Gap - February 4, 2025
- Tons of New Apps Added on PikaPods, Plus More Features!FREE $5 Welcome Credit Offer Still Good! - February 2, 2025
- Need a High RAM VPS?ByteHosting Has a HOT DEAL For You! - February 1, 2025
I’m confused about a few things and haven’t made this change yet. Can you share a more detailed cover letter?