Documentation Language: Swift

Framework

SSHClient

A high-level Swift API for SSH sessions, remote commands, interactive shells, and local port forwarding.

Overview

SSHClient builds on NIOSSH and the local SSHAgent module to provide a small async API for common client-side SSH work. The library manages the connection channel, negotiates user authentication, opens session channels for commands or shells, and can also create direct TCP/IP forwarding channels for local listeners.

The target is designed for applications that want SSH support without rebuilding the lower-level NIOSSH pipeline for each use case. It keeps the transport concerns explicit while still exposing a concise surface for connection management and session execution.

Topics

Essentials

?
SSHClient

Actor that manages SSH connections, sessions, and local forwards.

S
SSHClientConfiguration

Connection settings used to create an SSHClient.

S
CommandResult

Output captured from a completed remote command.

E
SSHClientError

Errors raised by the high-level SSH client API.

Interactive and Non-Interactive Sessions

F
connect()

Establish the underlying SSH connection if one is not already open.

F
executeCommand(_:)

Execute a non-interactive command on the remote server.

A
Running Sessions

Open a remote command channel or attach the local terminal to an interactive shell.

Port Forwarding

S
PortForwardingConfiguration

Local forwarding settings used to bind a listener and open a direct TCP/IP channel.

F
startPortForwarding(_:)

Start a local forwarding server for the supplied configuration.

A
Forwarding Traffic

Expose a local listening socket and tunnel accepted connections through the SSH transport.

Authentication and Internals

A
Authentication Flow

Choose an authentication strategy and understand how the client falls back when a method is unavailable.

C
SSHWrapperHandler

Channel handler that wraps forwarded bytes in SSHChannelData.