throwawaysh is a Go SSH service that starts one ephemeral krun microVM per SSH session and connects the session to a shell inside that VM.
- Accepts SSH connections (default
:2222). - Boots a session-scoped microVM for each session.
- Uses the VM console for non-PTY sessions.
- Uses a guest PTY agent for interactive terminal sessions (resize/signals/stdin forwarding).
- Keeps host-side service logs structured with
slog(textorjson).
- Go
1.25+ libkruninstalled on the host- A Linux rootfs directory for guest sessions (
--rootfs)
Use the provided Makefile:
make buildThis will:
- Build the service binary at
./throwawaysh - Build the guest agent for Linux (
arm64by default) - Install the guest agent into the configured rootfs at:
./rootfs/usr/local/bin/throwawaysh-guest-agent
Useful targets:
make build-service
make build-agent
make install-agent
make test
make lint
make cleanOn macOS, make build-service also codesigns the service binary using cmd/throwawaysh/entitlements.plist.
Minimal run:
go run cmd/throwawaysh/main.go --rootfs /path/to/rootfsOr run the built binary:
./throwawaysh --rootfs /path/to/rootfsDefault credentials (when passwordless mode is disabled):
- Username:
test - Password:
test
ssh -p 2222 test@localhostFor passwordless mode:
./throwawaysh --rootfs /path/to/rootfs --allow-passwordless
ssh -p 2222 anyuser@localhost -o PreferredAuthentications=none -o PubkeyAuthentication=noInteractive SSH terminal sessions (pty-req) rely on the guest agent binary inside the rootfs:
- Expected guest path:
/usr/local/bin/throwawaysh-guest-agent - If missing, PTY session startup fails with a clear error.
Install helper script:
./install_guest_agent.sh ./rootfsFlags:
--listen-addr(default::2222)--host-key-path(default:server_key)--rootfs(required)--username(default:test)--password(default:test)--allow-passwordless(default:false)--log-level(default:info;debug|info|warn|error)--log-format(default:text;text|json)--version
Environment variables (flag-compatible):
SSH_ADDRSSH_HOST_KEY_PATHSSH_ROOTFSSSH_USERNAMESSH_PASSWORDSSH_ALLOW_PASSWORDLESSSSH_LOG_LEVELSSH_LOG_FORMAT
Custom listen/auth:
./throwawaysh --listen-addr :2222 --rootfs /path/to/rootfs --username demo --password demoJSON logs:
./throwawaysh --rootfs /path/to/rootfs --log-level debug --log-format json- The server creates the SSH host key file at
--host-key-pathif it does not already exist. - Each SSH session maps to an isolated VM lifecycle.
- Current service is intentionally simple and focused on per-session isolation over persistence.