Skip to main content

Module ssh_config_edit

Module ssh_config_edit 

Source
Expand description

Adding a host to the user’s ~/.ssh/config from Remotes, and finding a host’s Host line there (SPEC_REMOTES_PANE_2026_10_05.md §4.4).

The file stays the one place hosts are defined, so every tool sees a host added here. AgentMux only ever appends a new Host block at the end (an Include and earlier Host * defaults still apply to it as before) and never rewrites an existing entry. It refuses an alias the file already names, keeps a copy of the file before its first write, and creates the file owner-only when it is missing.

Every value is checked before it is written: one word, no control characters, no quotes, so a field can’t end its line and start a directive of its own (a ProxyCommand, say).

Structs§

NewHost
What the Add remote form gives.

Constants§

BACKUP_NAME
The copy kept of the config before AgentMux’s first write.

Functions§

add_host_in
Append host to the config at config (Includes relative to ssh_dir). Returns the block written.
all_host_words 🔒
Every name any Host line in the config (and what it includes) gives, patterns included.
host_block
The Host block for host, checked: an alias (required, a plain name) and the optional settings, each on its own line.
locate_in
The file and 1-based line of the Host line naming alias, following Includes.
owner_only 🔒
Owner read and write only, as ssh wants its config (Unix; on Windows a new file under the user’s profile is already the user’s).
user_paths
The user’s ssh dir and config.
word 🔒
One word for an ssh config line: no whitespace, quotes, # at the start, or control characters.