3.0k
Connect
  • GitHub
  • Mastodon
  • Twitter
  • Slack
  • Linkedin

Blog

Transform SSH Host Management with sshs and Flox

Steve Swoyer | 21 February 2025
Transform SSH Host Management with sshs and Flox

Fun Package Fridays is a series where we ask members of the Flox team to share fun and perhaps not-so-well-known tools and utilities you can find in the Flox Catalog, powered by Nix. Today's edition comes from staff writer Steve Swoyer, who says he's sadly ecstatic that his heroes are news.

Picture this: you’re awash in SSH connections. Day in and day out, you use SSH to connect to app servers, databases, Kubernetes nodes, CI/CD runners, seedboxes, Raspberry Pis, routers, switches, etc. These endpoints are dispersed across AWS, your org’s on-prem infrastructure, hosting providers in the EU, your home, your parents’ condo, and your best friend’s third-floor walk-up in the East Village.

You can’t keep track of them all. You have trouble remembering what their names are, what they’re for, etc. And each requires different key pairs, usernames, and ports. Some even require YubiKeys!

Maybe you don’t have to picture it, ‘cuz you’re living it. But how do you deal with it?

Sshs! No, I’m not sshshing you, I’m introducing this week’s Fun Package Friday (R)(TM) entry: sshs, a terminal user interface (TUI) for SSH. If you deal with a surfeit of SSH hosts, keys, ports, and so on, sshs is for you.

It’s a neat tool that does one thing and one thing only. Read on to find out how it can fit into your workflow.

Getting It

First thing’s first: You’ve already downloaded and installed Flox, right?

If so, you can get our sshs package by initializing a Flox environment in a new project folder and installing it from the Flox Catalog. Once you activate your Flox environment, the command sshs is available for use.

This is literally as simple as typing:

mkdir sshs && cd sshs
flox init && flox install sshs
flox activate

You can also flox install sshs into an existing Flox project environment, of course.

Using It

This walk-through is going to be short and sweet, because sshs does basically one thing—superbly.

Maybe you’re familiar with .ssh/config, which gives you a way to define ssh host entries, but you’ve never bothered populating it. Or maybe you have populated it, but you gave up trying to maintain it, because it doesn’t eliminate the cognitive overhead involved in keeping track of a slew of SSH connections. Either way, you still have to remember which names you’ve given to which hosts. For example, typing:

ssh foo

And hitting the TAB key might return:

foo		foooobar
foobar		foo-bar
fooo		fooo-barr
fooobar		foooo-barrrr
foooo		fooooo-barrrr

Which host do you want? (Aside: Maybe you shoulda used more descriptive names for stuff?) Usually you end up cat- or bat-ing your .ssh/config file to figure out which host alias corresponds to which real-world host. If only there were a TUI tool that would give you a way to visually scroll through the connections you’ve predefined in .ssh/config—identifying, selecting and easily initiating just the connection you want.

Well obviously there is. This is sshs’ raison d’etre. Let me show you:

sshs displays not just the specific alias assigned to a host, but its connection details, too. Using the cursor keys navigates up and down. Hitting ENTER establishes an SSH connection and puts you into a remote pty.

Typing in the bounded box across the top of the screen enables a kind of very fuzzy matching: if the letters match a string in .ssh/config, sshs will show them in its window.

For example, typing “epitro” (for epitropos, one of my internal servers) shows two results:

The letters in the string “flox” are a little more unique, yielding only relevant results:

Again, pressing ENTER establishes the connection and—if the contents of your .ssh/config file are in order—puts you into a pty on the remote system. Note: if there’s an error anywhere in config, sshs will exit when you hit ENTER to establish a connection—any connection, even one that’s unrelated to the error.

It seems to parse and evaluate config when it establishes the connection. So you could get errors like this:

flox [sshs] daedalus@askesis:~/dev/sshs$ sshs
Running command: ssh "anaximander"
/home/daedalus/.ssh/config line 106: Bad port '65536'.
/home/daedalus/.ssh/config: terminating, 1 bad configuration options

If your config file is in order, you can connect as expected. Below, I’ve connected to my test box noein:

And once you type exit to close your SSH session, you’re put right back into sshs.

The only thing it doesn’t do—a feature that could improve it, I think—is give you a way to edit host entries.

This has been Fun Package Friday

That’s basically sshs. It does one thing and it does it well. And looks good doing it.

You can find sshfs and about 150,000 other packages (along with millions of historical package-version combinations) in the Flox Catalog. Need an ssh package to go along with sshs? Need sshfs? Or how about wish, from the redoubtable, irreplaceable, magnificent folks at Charm? They’re in there.

And with that I give you … The Weekend.

Happy Hacking!