SSH session
Command to execute
Handler for stdout data
Promise with exit code
Execute a command in a specific directory using exec mode
SSH session
Command to execute
Working directory
Handler for stdout data
Promise with exit code
Extract the algorithm name from an SSH public key blob. The blob is self-describing: it begins with a 4-byte big-endian length followed by the algorithm name, e.g. "ssh-ed25519" or "ssh-rsa".
the raw host key blob
the algorithm name, or undefined if the blob cannot be parsed
Compute the OpenSSH-style SHA256 fingerprint of a host key for display to the user,
e.g. "SHA256:Xn5vB...". Matches the format shown by the standard ssh client.
the raw host key blob presented by the server
the fingerprint string
Determine which host key algorithm to request from the server, based on the pinned host key. Returns undefined when verification is disabled, no key is pinned, or the pinned key cannot be parsed - in which case ssh2's default algorithm negotiation applies.
the SSH session being connected
the host key algorithm names to request, or undefined to use the default negotiation
Return the algorithm name of the pinned host key (e.g. "ssh-ed25519", "ssh-rsa"), or undefined when verification is disabled, no key is pinned, or the pinned key cannot be parsed.
the SSH session being connected
the pinned host key algorithm name, or undefined
Handle SSH connection errors with appropriate error messages
The error object
Flag indicating if authentication has failed
Promise reject function
Optional connection state carrying host key verification results
Build the ssh2 host key verifier callback. Host key verification runs during the SSH handshake, before any credentials are sent, so an untrusted server never receives the user's password.
The presented key is trusted when:
Otherwise (no pinned key, or the key changed) the decision is delegated to the session's interactive SshSession.hostKeyVerifier hook if one is set (trust on first use); when no hook is available (e.g. non-interactive SDK usage) the connection is rejected.
the SSH session being connected
optional state updated when a key is rejected, so a clear error can be surfaced
an ssh2 hostVerifier callback
Check whether a session can establish a working SSH connection. Resolves true on success, false for non-host-key failures, and rejects with a host-key ImperativeError when the key is untrusted or changed, so callers can tell that apart from bad credentials.
the SSH session to validate
a promise resolving to true/false, or rejecting with a host-key error
Generated using TypeDoc
Execute a command using exec mode (no shell wrapping, faster)