Skip to main content

Module ssh

Module ssh 

Source
Expand description

SSH terminals (P2 of SPEC_REMOTE_TERMINALS_AND_DURABLE_SESSIONS_2026_10_02.md).

A pane on an SSH connection runs the system ssh in its PTY (spec §3.1): the user’s own ~/.ssh/config, keys, agent and known hosts apply, and ssh asks for a password, a passphrase or a new host key in the terminal itself, where the user answers it. The askpass bridge (§5.3), which an agent’s non-interactive use needs, comes later.

Enums§

Control
What to ask a shared connection (ssh -O).

Constants§

EXIT_CONNECTION_FAILED
ssh exits 255 when it could not connect, could not authenticate, or the connection dropped; any other code is the remote command’s own.

Functions§

binary
The ssh to run: the first on PATH, then (Windows) the OpenSSH client Windows installs, which an inherited PATH can lack.
binary_for_user
binary for the user’s own interactive ssh pane, whose prompts are the user’s to answer in it: a native client is preferred whatever its version (Windows 10’s inbox OpenSSH is 8.1), still for its name resolution.
connection_lost
Whether ssh ending with code means it had no connection, or lost it, rather than that the remote shell ended (exit included). A session on a shared connection that was closed or died ends this way too.
control
The ssh arguments asking dest’s shared connection in dir to op: the same socket a pane’s launch shares.
control_dir
Where ControlMaster sockets go (macOS and Linux; Windows’ OpenSSH has no connection sharing): a private, owner-only directory, since anyone who can open a socket there can use the connection. None (no sharing; ssh still connects) if it can’t be made so, or a socket in it would be too long.
launch
The ssh arguments for a pane. control_dir, on macOS and Linux, is where connection-sharing sockets live (ControlMaster), so a second pane on the same connection reuses the first one’s and asks for nothing.
launch_exec
The ssh arguments for one command run without a terminal (an agent’s Shell): launch’s, with -T in place of -tt, since its output is read, not a session shown.
lost_message
What the connection’s status says when a pane’s ssh lost it.
lost_note
The line a plain SSH pane shows, under ssh’s own reason, when it has no connection: the pane stays, and Enter starts ssh again.
missing_binary_message
What to say when there is no ssh, with how to get it on this platform.
pane_lost_connection
Whether a pane’s ssh, ended with code, lost its connection (or never had one). stopped_by_srv: srv ended it itself (the pane closed, or restarted), and ssh then exits 255 too (closing its pty does, and a session on a shared connection does on SIGTERM), which is no lost connection.
quote
One word for a POSIX shell: single-quoted, with ' written as '\''.
quote_path
quote for a remote path, leaving a leading ~ or ~/ unquoted so the remote shell expands it to the remote home (OSC 7 and users write it).
remote_command
The command line ssh hands to the remote user’s login shell: the pane’s command, run in cwd when one is set, or for a plain pane with a cwd, the login shell started there. None for a plain pane with no cwd: ssh then starts the login shell itself.
set_pane_env
Name the pane in launch’s SetEnv too (AGENTMUX_BLOCKID), so a host that accepts it (AcceptEnv AGENTMUX_*) lets the pane’s stats badge find its shell there (PaneProcs). Dropped quietly by any other host, like the rest of that SetEnv. A block id is AgentMux’s own UUID; anything with another character is left out rather than quoted.
shared_control_dir
control_dir for this srv’s channel: where every ssh it runs to a host (panes, agents’ commands, the helper, files) shares one connection. None where ssh can’t share connections, and then there is nothing to ask -O.