Table of Contents

Class SshEndpointOptions

Namespace
SshSharp.Extensions.DependencyInjection
Assembly
SshSharp.Extensions.DependencyInjection.dll

One named SSH endpoint, registered with services.AddSshClient(name): where to connect and how to authenticate. Mutable, so configuration can bind to it (.BindConfiguration("Ssh:Deploy")). Set either ConfigAlias, to connect through ssh_config, or Host.

public sealed class SshEndpointOptions
Inheritance
SshEndpointOptions
Inherited Members

Properties

AcceptNewHostKeys

Accept and record the key of a host not yet in KnownHostsFiles (StrictHostKeyChecking accept-new). Off by default: an unknown host fails the connection. A changed key always fails it.

ConfigAlias

Connect by this ssh_config alias instead (ProxyJump, IdentityFile, known_hosts and the rest come from the user's and the system's ssh_config). Host, Port, UserName, PrivateKeyFiles and KnownHostsFiles are then ignored; Password is still offered.

ConfigureClientOptions

Adjusts the client options built from these settings (an agent, a custom host key verifier, keys held elsewhere, a proxy, ...): receives the services and the options built so far, and returns the options to use. Not used with ConfigAlias.

ConnectTimeout

How long one connection attempt, handshake and authentication included, may take (default 30 seconds).

Host

The server's host name or address. Required unless ConfigAlias is set.

KeepAliveInterval

Send keep-alives at this interval, so a dead connection is noticed (none by default).

KnownHostsFiles

The known_hosts files that hold the server's host keys (default: the user's ~/.ssh/known_hosts). New keys are recorded in the first one when AcceptNewHostKeys is set.

MaxReconnectDelay

The longest wait between the shared connection's reconnection attempts (default 1 minute).

Password

A password, tried after any keys. Keep it out of source control: bind it from a secret store.

Port

The server's port (default 22).

PrivateKeyFiles

Private key files (OpenSSH, PEM or PuTTY format) to authenticate with, tried in order.

PrivateKeyPassphrase

The passphrase of encrypted PrivateKeyFiles.

ReconnectDelay

The wait before the shared connection's first reconnection attempt; it doubles after each failure (default 1 second).

UserName

The user to log in as. Required unless ConfigAlias is set (then ssh_config, or the local user, decides).