Docs: getting started

Product/Service: sfm (SSH Fleet Monitor)

Requirements

Install

sfm is a single binary, and nothing is installed on your hosts. Builds are not public yet: request early access to be told when one is available.

First run

sfm hosts import
sfm hosts test --all
sfm web

sfm hosts import reads your ~/.ssh/config. sfm hosts test --all signs in to each host and explains any failure. sfm web then prints:

sfm web: listening on http://127.0.0.1:PORT/ (Ctrl-C to stop)
Open http://127.0.0.1:PORT/#token=TOKEN

Open the link. The token is new on every start.

Two other ways to add a host:

sfm hosts add admin@server.example.com
sfm hosts add --local

--local adds the machine sfm runs on. It needs no SSH server and no key.

Configure

SettingEffectDefault
SFM_DATA_DIR (environment)Where sfm keeps its database, session token and encrypted keys$XDG_DATA_HOME/sfm, else ~/.local/share/sfm
sfm web --port NThe port the dashboard listens on, always on 127.0.0.10: any free port
sfm web --offline or SFM_OFFLINE=1Use cached vulnerability data only and send no requestOff
sfm hosts report ALIAS --every DURATIONHow often sfm web runs a status scan of the host, from 1m to 24h; --off stops it, --default restores the default5m
sfm hosts key ALIASThe host's key: ssh-agent or IdentityFile (--existing), a key file (--path FILE), a key pasted on stdin (--paste) or a new ed25519 key (--generate)--existing
sfm hosts consent ALIAS --grantAllow the Lynis audit on the host; --revoke withdraws itNot granted
sfm hosts public-ip ALIAS IPSet the host's public IP for the report and the topology; sfm never looks it up onlineA public address found on the host's own interfaces, if any

Commands

CommandWhat it does
sfm webServe the local web UI on 127.0.0.1 with a new session token
sfm web --rotate-tokenIssue a new token; a running sfm web rejects the old one
sfm hosts import [--file PATH]Import hosts from ~/.ssh/config, or from another file
sfm hosts add [USER@]HOST[:PORT]Add a host by hand; --jump USER@HOST[:PORT],... goes through jump hosts, --alias NAME and --tag TAG name and tag it
sfm hosts listList the hosts in the inventory
sfm hosts tag ALIAS TAG...Tag a host, or remove its tags with --remove
sfm hosts test ALIAS... | --allTest the connection to hosts and explain any failure
sfm hosts keysList each host's key: type, fingerprint and reference only
sfm hosts key ALIAS --show-publicPrint a pasted or generated key's public line and setup steps again
sfm hosts disable ALIASStop monitoring a host and keep its stored data; sfm hosts enable ALIAS turns it back on
sfm hosts remove ALIAS --yesRemove a host and delete everything sfm stored about it; cannot be undone
sfm report --format ecs|prometheusPrint the fleet report from the stored scans as ECS NDJSON (Wazuh) or Prometheus text (Grafana); --output PATH writes a file, --host ALIAS limits it
sfm mcpServe the read-only MCP tools on stdio for an AI agent
sfm list-hosts --jsonThe MCP tools from the command line: also get-host-status, list-findings, get-finding, get-fix-steps and refresh-host-status, with the same arguments and the same JSON answer
sfm licensesPrint the third-party notices and the Lynis license (GPL-3.0)
sfm --version, sfm --helpPrint the version, or the usage text

AI agents

sfm mcp lets Claude Code, Codex or any other stdio MCP client answer questions about your fleet from stored scan data, with no shell. For Claude Code, put this in a project's .mcp.json:

{
  "mcpServers": {
    "sfm": {
      "command": "sfm",
      "args": ["mcp"],
      "env": {
        "SFM_DATA_DIR": "/home/you/.local/share/sfm",
        "SSH_AUTH_SOCK": "/run/user/1000/ssh-agent.socket"
      }
    }
  }
}

For Codex, in ~/.codex/config.toml:

[mcp_servers.sfm]
command = "sfm"
args = ["mcp"]
env = { SFM_DATA_DIR = "/home/you/.local/share/sfm", SSH_AUTH_SOCK = "/run/user/1000/ssh-agent.socket" }

Use the full path to the binary if sfm is not on the client's PATH, and your own agent socket (echo $SSH_AUTH_SOCK).

Troubleshooting

SymptomFix
sfm mcp exits with status 1 and names a pathThere is no database at that path, and sfm mcp never creates one. Add hosts and run sfm web first, and set SFM_DATA_DIR in the MCP client's env block: clients often start servers with a reduced environment.
A connection test stops at a new or changed host keysfm reads known_hosts and never writes it. Check the fingerprint and accept the key with ssh, as sfm hosts test explains.
--paste and --generate are disabled on a headless Linux serverThey need the Secret Service through secret-tool and an unlocked keyring. Use ssh-agent or a key path instead.
refresh_host_status cannot sign in from an MCP clientIt needs SSH_AUTH_SOCK in the client's env block for ssh-agent keys, and it never asks for a passphrase.
macOS shows privacy prompts for your terminal while this machine is scannedExpected when sfm is started from a GUI terminal: the scan's commands run as that terminal's child processes.
The Lynis audit will not run on this machineIt refuses to run as root. Run sfm as a normal user to audit the machine it runs on.
Back to the sfm home page