Skip to content

Auto-supply the stored password to the terminal (no more password prompts)#25

Merged
timhartmann7 merged 1 commit into
mainfrom
feat/terminal-password-auth
May 29, 2026
Merged

Auto-supply the stored password to the terminal (no more password prompts)#25
timhartmann7 merged 1 commit into
mainfrom
feat/terminal-password-auth

Conversation

@timhartmann7
Copy link
Copy Markdown
Owner

Hosts configured with password authentication worked fine for metrics, quick-commands, and snippets (which use the russh client and fall back to the stored password), but the interactive terminal spawns the system ssh binary, which can't read the stored password and prompted for it on every connection.

This wires the stored password into the terminal's ssh child through SSH_ASKPASS:

  • The terminal points SSH_ASKPASS at the omny binary itself and sets SSH_ASKPASS_REQUIRE=force, passing the password via the child's environment (OMNY_ASKPASS_PASSWORD).
  • When ssh needs a password it re-invokes omny in askpass mode; omny prints the password and exits.
  • Keys and the SSH agent are still tried first. The helper is only invoked when ssh actually asks for a password. Hosts without a stored password are unchanged.

Security: The password is only ever passed through the child process environment (it already lives in plaintext in hosts.toml). It is never written to disk, never on the command line / ps, and never sent to the remote. The askpass helper answers genuine password prompts only; it never feeds the password to a host-key yes/no confirmation. Requires OpenSSH 8.4+ (modern macOS/Linux/Termux); if current_exe is unavailable it falls back to the old interactive prompt.

Covered by 4 tests for the prompt-discrimination logic.

@timhartmann7 timhartmann7 merged commit cd92364 into main May 29, 2026
3 checks passed
@timhartmann7 timhartmann7 deleted the feat/terminal-password-auth branch May 29, 2026 13:12
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant