matmoul 59f37d8455 feat: add known_hosts entries to ssh menu
Allow loading hosts from ~/.ssh/known_hosts via -k, with an optional user override. Also update the usage text and keep direct SSH connections working for generated known_hosts entries.
2026-05-31 23:59:29 +02:00

mtm-ssh-menu

A small Bash utility to browse SSH targets from YAML configuration and connect to them with fzf.

Features

  • Interactive selection with fzf
  • Global defaults for SSH user, port, and jump hosts
  • Per-host overrides in grouped YAML files
  • Support for jump hosts via named aliases
  • Simple, dependency-light Bash script

Requirements

  • bash
  • ssh
  • fzf
  • jq
  • yq

Usage

./mtm-ssh-menu [--config-dir DIR]

Options:

  • --help: show help
  • --config-dir DIR: use a custom configuration directory

By default, the script reads configuration from:

  • ~/.config/mtm-ssh-menu/global.yaml
  • ~/.config/mtm-ssh-menu/hosts/*.yaml

Configuration format

global.yaml

ssh:
  default_user: root
  default_port: 22
  default_options: ""
  jump_hosts:
    office: "user@192.168.10.11"

hosts/dev.yaml

group: dev
servers:
  - name: api-1
    aliases:
      - api
      - backend
    host: 192.168.10.11
    user: dev
    port: 2222

Each host entry can define:

  • name
  • aliases
  • host
  • user
  • port
  • jump_host

Example workflow

  1. Create the config directory.
  2. Add global.yaml and one or more files under hosts/.
  3. Run the script.
  4. Select a target in the menu and connect.

Sample configuration

A complete sample configuration is available in sample-config/.

Notes

  • The script requires yq, jq, ssh, and fzf to be installed.
  • Jump hosts are resolved by name from global.yaml.
  • If a host does not define a user or port, global defaults are used.
S
Description
A Bash SSH target picker built around fzf and YAML configuration.
Readme 78 KiB
Languages
TypeScript 82.1%
Shell 17.9%