Table of Contents

Class SshConfig

Namespace
SshSharp.Config
Assembly
SshSharp.dll

An OpenSSH client configuration (ssh_config): parsed into Host sections and resolved per host with OpenSSH's first-obtained-value-wins rules.

public sealed class SshConfig
Inheritance
SshConfig
Inherited Members

Properties

Blocks

The sections of every loaded file in order; the first section of each file is its global part before any Host line.

Methods

Combine(params SshConfig[])

Combines several configs; earlier ones take precedence (first obtained value wins).

Load(string, string?)

Loads a config file. A missing file gives an empty config. See Parse(string, string?) for baseDirectory.

LoadAsync(string, string?, CancellationToken)

Loads a config file asynchronously. A missing file gives an empty config.

LoadDefault(string?)

Loads the standard files like ssh does: the user's ~/.ssh/config first, then the system-wide file (/etc/ssh/ssh_config, or %ProgramData%\ssh\ssh_config on Windows). Earlier files win.

Parse(string, string?)

Parses ssh_config text. Throws FormatException (with the line number) on syntax errors.

Resolve(string, SshConfigResolveOptions?)

Resolves the effective settings for host.

ResolveAsync(string, SshConfigResolveOptions?, CancellationToken)

Resolves the effective settings for host, as Resolve(string, SshConfigResolveOptions?) does, awaiting ExecMatcher and HostCanonicalizer when the config needs them (Match exec, CanonicalizeHostname).