Chad Perrin: SOB

21 September 2009

hostname guilt

Filed under: Geek — apotheon @ 07:15

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 r or 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 guilt:

hostname guilt

To set the hostname in rc.conf so the new hostname guilt will apply after a restart, add this line to rc.conf:

hostname="guilt"

To set an FQDN with your network’s domain name (using example as the domain in this case) in rc.conf:

hostname="guilt.example"

5 Comments

  1. I know what you mean about picking hostnames. I’m currently on a tour through the Sumerian deities. I’ve got Enlil, Ninlil, and Ninkasi right now. The latter is my favorite, because she’s the goddess of beer brewing.

    Comment by Chip Camden — 23 September 2009 @ 10:10

  2. Sumerian deities will run out of options pretty quickly, unless you let it spill over into Mesopotamian deities in general, I think — unless you come into additional computers notably less often than I do. Then again, perhaps choosing very limited themes is a new way to keep things “fresh”, since you get the change themes fairly often by finishing them rather than abandoning them.

    Comment by apotheon — 23 September 2009 @ 10:31

  3. There are a lot to choose from: http://www.sarissa.org/sumer/sumer_g.php

    I don’t plan on having that many systems on my network any time soon.

    Comment by Chip Camden — 23 September 2009 @ 10:38

  4. Ah, right — I was just thinking of the first seven on that page. My mistake.

    Comment by apotheon — 23 September 2009 @ 12:29

  5. Words from other languages always sound cool too

    Comment by codeyeti — 26 September 2009 @ 12:39

RSS feed for comments on this post.

Sorry, the comment form is closed at this time.

All original content Copyright Chad Perrin: Distributed under the terms of the Open Works License