Jump to content

Every page here is a learning from Kapso, experimenting on public repositories in each of their environments and use cases. Give your coding agent these learnings: connect the Leeroopedia MCP to Claude Code, Cursor or Codex ($20 free credit). Powered by Leeroo · founders@leeroo.com

Environment:2giosangmitom Sqmeow nvim SSH Binary Requirement

From Leeroopedia
Knowledge Sources
Domains Networking, Connection_Management, Infrastructure
Last Updated 2026-10-16 14:00 GMT

Overview

An ssh client binary in PATH is required when database connections specify an SSH tunnel (via) to reach databases behind a bastion host.

Description

The sqmeow-core engine does not implement SSH itself. When a connection defines a via field (e.g. user@bastion:port), the engine spawns an external ssh process with -N -L forwarding options. The SSH binary path is configurable (passed as the program argument to tunnel::open), defaulting to ssh from PATH.

The spawned SSH process uses ExitOnForwardFailure=yes and BatchMode=yes, meaning it will fail immediately if the port forward cannot be established and will not prompt for passwords interactively. Authentication must be handled via SSH keys or agents.

Usage

This environment is required only when a connection in connections.toml includes a via field. Connections to databases reachable directly (without a bastion) do not need SSH.

System Requirements

Category Requirement Notes
OS Linux, macOS, or any system with an SSH client OpenSSH or compatible
Software ssh binary in PATH OpenSSH client or compatible SSH implementation
Network TCP access to the bastion host The bastion must accept SSH connections on the specified port

Dependencies

System Packages

  • openssh-client (or equivalent SSH implementation)

SSH Configuration

  • SSH key-based authentication configured for the bastion host
  • BatchMode=yes is set by the engine — no interactive password prompts
  • ExitOnForwardFailure=yes is set by the engine — fails fast on port-forward errors

Credentials

No environment variables required. Authentication is handled by the SSH agent or key files configured outside sqmeow.nvim. The via field in connections.toml specifies the SSH target as user@host or user@host:port.

Quick Install

# Debian/Ubuntu
sudo apt install openssh-client

# macOS (pre-installed, or via Homebrew)
brew install openssh

# Verify
ssh -V

Code Evidence

SSH process spawn from core/sqmeow-core/src/server/tunnel.rs:65-86:

let mut command = Command::new(program);
command
    .args([
        "-N",
        "-o",
        "ExitOnForwardFailure=yes",
        "-o",
        "BatchMode=yes",
        "-L",
    ])
    .arg(format!("127.0.0.1:{local}:{host}:{port}"));
if let Some(port) = ssh_port {
    command.args(["-p", port]);
}
let mut child = command
    .arg(destination)
    .stdin(Stdio::null())
    .stdout(Stdio::null())
    .stderr(Stdio::piped())
    .kill_on_drop(true)
    .spawn()
    .map_err(|error| format!("`{program}` could not be started: {error}"))?;

Tunnel readiness wait loop from core/sqmeow-core/src/server/tunnel.rs:88-104:

let deadline = tokio::time::Instant::now() + sqmeow_adapters::CONNECT_TIMEOUT;
while TcpStream::connect(("127.0.0.1", local)).await.is_err() {
    if let Ok(Some(status)) = child.try_wait() {
        // ssh exited — read stderr for the reason
        return Err(format!("ssh to `{via}` exited with {status}: {}", stderr.trim()));
    }
    if tokio::time::Instant::now() >= deadline {
        return Err(format!("ssh to `{via}` did not open the tunnel in time"));
    }
    tokio::time::sleep(Duration::from_millis(100)).await;
}

Rejected URL types from core/sqmeow-core/src/server/tunnel.rs:35-43:

Dialect::Sqlite | Dialect::DuckDb => {
    return Err("a database in a file is not reached through a tunnel".to_owned());
}
// ...
if scheme.eq_ignore_ascii_case("mongodb+srv") {
    return Err("a MongoDB SRV address finds its hosts in DNS, so it cannot go through one tunnel".to_owned());
}

Common Errors

Error Message Cause Solution
`ssh` could not be started: No such file or directory SSH binary not installed or not in PATH Install openssh-client or configure the binary path
Permission denied (publickey) SSH key not configured for bastion Set up key-based auth; BatchMode=yes disables password prompts
ssh to `...` did not open the tunnel in time Bastion unreachable or port-forward failed Check network access; ExitOnForwardFailure=yes fails fast
a database in a file is not reached through a tunnel SQLite/DuckDB URL with via Remove the via option for file-based databases
a MongoDB SRV address finds its hosts in DNS mongodb+srv:// with via Use a standard mongodb:// URL listing hosts explicitly

Compatibility Notes

  • File-based databases (SQLite, DuckDB): Cannot use tunnels; the via option is rejected.
  • MongoDB SRV: mongodb+srv:// addresses resolve hosts via DNS and cannot go through a single tunnel.
  • Multi-host cluster URLs: URLs with comma-separated hosts (e.g. Scylla scylla://a,b/ks) are rejected; a tunnel reaches one host.
  • BatchMode: Interactive password authentication is disabled. Keys must be pre-configured.
  • Binary path: The program argument allows a custom SSH binary path, not just ssh.

Related Pages

Page Connections

Double-click a node to navigate. Hold to expand connections.
Principle
Implementation
Heuristic
Environment