Table of Contents

Namespace Tmds.Ssh

Main Types

The library provides two client types:

  • SshClient - For connecting to SSH servers to execute remote commands, forward connections, and perform filesystem operations.
  • SftpClient - For performing filesystem operations on SSH servers using SFTP (SSH File Transfer Protocol).

The documentation for both types includes examples to help you get started.

Logging

The library supports logging through Microsoft.Extensions.Logging.

In production, the log level should be set to Information or higher.

Under these levels, the logged messages may include:

  • usernames
  • hostnames
  • key types
  • authentication methods
  • public keys
  • file paths (including those of private keys)

The Debug and Trace loglevels should not be used in production. Under the Trace level all packets are logged. This will expose sensitive data related to the SSH connection and the application itself.

Classes

AlgorithmList

Represents an ordered set of algorithm names.

CertificateCredential

Credential for certificate-based authentication.

Credential

Base class for SSH credentials.

DownloadEntriesOptions

Options for downloading directory entries.

EnumerationOptions

Options for enumerating directory entries.

ExecuteOptions

Options for executing commands.

FileEntryAttributes

Attributes of a filesystem entry.

FileOpenOptions

Options for opening files.

HostCertificateInfo

Information about host certificate.

HostKey

Represents a host key.

KerberosCredential

Credential for Kerberos authentication.

LocalForward

Controls local port forwarding to a remote endpoint.

NoCredential

Credential for 'none' authentication method.

PasswordCredential

Credential for password authentication.

PrivateKeyCredential

Credential for private key authentication.

Proxy

Base class for SSH connection proxies.

PublicKey

Represents an SSH public key.

RemoteEndPoint

Base class for remote endpoints.

RemoteForward

Controls remote port forwarding to a local endpoint.

RemoteHostEndPoint

Remote endpoint specified by hostname and port.

RemoteIPEndPoint

Remote endpoint specified by IP address and port.

RemoteIPListenEndPoint

Remote listen endpoint for port forwarding.

RemoteListener

Listens for incoming connections on the remote server.

RemoteProcess

Represents a remote process.

RemoteUnixEndPoint

Remote Unix domain socket endpoint.

SftpClient

Provides a client for performing filesystem operations on SSH servers using SFTP (SSH File Transfer Protocol).

SftpClientOptions

Options for configuring SftpClient.

SftpDirectory

Represents a working directory on the SFTP server.

SftpDirectoryExtensions

Extension methods for ISftpDirectory.

SftpException

Exception for SFTP errors.

SftpFile

Stream for reading and writing SFTP files.

SignalName

Unix signal names.

SocksForward

SOCKS proxy server that forwards connections through the SSH server.

SshAgentCredentials

Credential for SSH agent authentication.

SshChannelClosedException

Exception thrown when an operation failed because the SSH channel is already closed.

SshChannelException

Exception thrown when the SSH channel becomes unusable.

SshClient

Provides a client for connecting to SSH servers to execute remote commands, forward connections, and perform filesystem operations.

SshClientSettings

Settings for configuring SshClient.

SshConfigSettings

Settings for configuring the SshClient using the OpenSSH ssh_config model.

SshConnectionClosedException

Exception thrown when an operation failed because the SSH connection is already closed.

SshConnectionException

Exception thrown when the connection becomes unusable.

SshConnectionInfo

Information about an opened SSH connection.

SshDataStream

Stream for channel data.

SshException

Base class for SSH exceptions.

SshOperationException

Exception thrown when an SSH operation fails. The connection and channel can still be used.

SshProxy

Proxy through an SSH server.

TerminalSettings

Terminal settings for pseudo-terminal allocation.

UnixFilePermissionsExtensions

Extension methods for UnixFilePermissions.

UploadEntriesOptions

Options for uploading directory entries.

Structs

HostAuthenticationContext

Context for host key authentication.

LocalFileEntry

Represents a local file entry during enumeration.

PasswordPromptContext

Context for password prompts.

PrivateKeyCredential.Key

Represents a private key.

RemoteConnection

Represents a connection made to a remote listener.

RemoteProcess.ExitStatus

Represents a process exit status.

SftpFileEntry

Represents a filesystem entry during enumeration.

SshConfigOptionValue

Value for an SshConfigOption.

StderrHandler

Handler for stderr output from remote processes.

Interfaces

ISftpDirectory

Interface for SFTP directory operations.

Enums

KnownHostResult

Result of host key verification against known hosts.

OpenMode

Mode for opening a file.

SftpError

SFTP error codes.

SshConfigOption

OpenSSH sshd_config options.

TargetDirectoryCreation

Behavior for target directory creation.

UnixFilePermissions

Unix file permissions flags.

UnixFileType

Unix file types.

UnixFileTypeFilter

Filter for Unix file types.

Delegates

DownloadEntriesOptions.ReplaceCharacters

Delegate for replacing invalid path characters.

HostAuthentication

Delegate for authenticating host keys.

LocalFileEntryPredicate

Delegate for filtering local file entries.

PasswordPrompt

Delegate for prompting the user for a password.

SftpFileEntryPredicate

Delegate for filtering file entries.

SftpFileEntryTransform<T>

Delegate for transforming an SftpFileEntry to a result.