After about six years, I finally got tired of my (wo)men and monsters of myth and legend theme for naming computers. After Phobos, Deimos, Asherah, Erebus, Kokopelli, Kraken, Fenris, Thoth, Koroni, Tyr, and many others, I’m feeling a little tapped out.
I recently bootstrapped myself a new laptop system, and needed a hostname. As is typical, I didn’t plan ahead for a hostname, and found myself staring at the dialog that asks me to name my computer during the FreeBSD install without any notion of what I was going to call it. I just pulled a corny word out of thin air and figured “It’s just temporary. I’ll change the hostname later, when I decide what it will really be called.”
Today, I got tired of it. The word I had plucked out of the air was
kukaburra, which is great an’ all, but it’s neither mythic nor terribly short and easy to type. Worse, I still had the previous laptop running so I could just harvest stuff off it across the network when I decided I wanted something from it, and the old laptop’s hostname is
kokopelli. I managed to make the mistake of seeing a nine-letter word with
k as the first and third letters, and the seventh and eighth letters being the same, assuming it was
kukaburra, and accidentally entering a command into an SSH session on
kokopelli. The names were just too similar. Luckily, I didn’t do any damage, but clearly things needed to change.
As I said, I was kinda tired of the same-ol’ method of choosing hostnames. I decided I’d use this to pick my new hostname for this laptop:
#!/usr/bin/env ruby lines = IO.readlines '/usr/share/dict/words' count = (rand * lines.length.to_i) - 1 puts lines[count]
I ended up with
guilt as the hostname for my “new” laptop, and frankly, I love it. I reserve the right to veto a randomly selected name in the future, and run the script a second time to get a more agreeable word — just in case I end up with something like
copyright, for instance.
(Note: Your Unix-like system may have its plaintext dictionary file in a different location than mine, if you aren’t using FreeBSD.)
Of course, I decided to use the
hostname command to change the hostname right away, as well as editing the
rc.conf file so that the change will be “permanent”. I issued the command to change the hostname in a terminal emulator window, and smiled — for about half a second. I suddenly realized I had changed the hostname on
kokopelli by accident, because I was using that particular terminal emulator window to do some remote work on the other laptop via SSH.
Yeah. Oops. I changed it back, then changed
kukaburra‘s name to guilt. All is now right with the world. I’ll just take this as proof that I made the right decision when I chose to change the hostname today.
Change FreeBSD Hostname
Just in case someone ends up here after doing a Google search for “change FreeBSD hostname”, I’ll explain how it’s done.
To immediately change the hostname (until the next restart) to
To set the hostname in rc.conf so the new hostname
guilt will apply after a restart, add this line to
To set an FQDN with your network’s domain name (using
example as the domain in this case) in