sshm, but in C
  • C 99.3%
  • Makefile 0.7%
Find a file
2026-06-15 12:28:16 +02:00
.gitignore Added cross-platform support 2026-06-15 12:22:34 +02:00
LICENSE Initial commit 2026-06-15 11:31:04 +02:00
Makefile Added cross-platform support 2026-06-15 12:22:34 +02:00
README.md Added badges 2026-06-15 12:28:16 +02:00
sshm.c Added cross-platform support 2026-06-15 12:22:34 +02:00

sshm-C

Language Platforms Dependencies License

sshm — a fast, cross-platform SSH Connection Manager with a TUI, rewritten in C.

This is a C port of the original Python sshm. A single source file builds on Windows and POSIX (Linux/macOS) and renders a full-screen terminal UI with VT (ANSI) escape sequences — no external runtime or dependencies beyond the system's OpenSSH client.

Features

  • TUI with a host list, live detail pane, scrollbar, and fuzzy / search.
  • Add, edit, and delete hosts from within the UI (a / e / d).
  • One-keypress connect (Enter) — drops you straight into ssh.
  • Upload public key (u) — dedup-appends your key to the host's ~/.ssh/authorized_keys (the ssh-copy-id equivalent).
  • A scriptable CLI for everything the TUI does.
  • Plain-text, pipe-delimited host store — easy to back up or edit by hand.

Requirements

  • Windows 10/11 with a VT-capable console (Windows Terminal, modern conhost), built with MinGW-w64 (gcc); or
  • Linux / macOS with any C11 compiler (gcc or clang).
  • The OpenSSH client (ssh) on your PATH.
  • Optionally make.

The platform-specific console, process, and filesystem code lives behind #ifdef _WIN32 branches in sshm.c: the Win32 Console API on Windows, termios + fork/exec on POSIX.

Build

With make (auto-detects the platform and output name):

make

On Windows (MinGW-w64) this produces sshm.exe; on Linux/macOS it produces sshm. To build directly without make:

# Windows (MinGW-w64)
gcc -O2 -Wall -Wextra -std=c11 -o sshm.exe sshm.c

# Linux / macOS
cc  -O2 -Wall -Wextra -std=c11 -o sshm     sshm.c

Pre-built Windows binaries live in builds/ (see Releasing a build below).

Usage

Run with no arguments to launch the TUI:

sshm

TUI keys

Key Action
/ Navigate hosts
Enter Connect to selected host
a Add a host
e Edit selected host
d Delete selected host
u Upload a public key to the host
/ Search / filter
r Reload host store
q Quit

CLI

sshm save <alias> -h HOST [opts]   Save (or overwrite) a host
sshm connect <alias>               Connect (alias: ssh)
sshm list [filter]                 List hosts (alias: ls)
sshm remove <alias>                Remove a host (alias: rm)
sshm upload-pubkey <alias> [-k]    Upload an SSH public key (alias: copy-id)
sshm help                          Show help

save options:

Flag Meaning Default
-h, --host Hostname / IP (required)
-u, --user SSH user current username
-p, --port Port 22
-i, --identity Identity (private key) file
-t, --tags Comma-separated tags
-n, --notes Free-form notes

Example:

sshm save web1 -h 203.0.113.10 -u deploy -i ~/.ssh/id_ed25519 -t "prod,web"
sshm connect web1

Storage

Hosts are stored in a single pipe-delimited file:

Windows:      %USERPROFILE%\.sshm\hosts
Linux/macOS:  ~/.sshm/hosts

Each line is alias|user|host|port|identity|tags|notes. Set the SSHM_DIR environment variable to override the directory.

License

See LICENSE.