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
Actor that manages SSH connections, sessions, and local forwards.
Connection settings used to create an SSHClient.
Output captured from a completed remote command.
Errors raised by the high-level SSH client API.
Interactive and Non-Interactive Sessions
Establish the underlying SSH connection if one is not already open.
Execute a non-interactive command on the remote server.
Start an interactive remote shell using a pseudo-terminal request.
Open a remote command channel or attach the local terminal to an interactive shell.
Port Forwarding
Local forwarding settings used to bind a listener and open a direct TCP/IP channel.
Start a local forwarding server for the supplied configuration.
Expose a local listening socket and tunnel accepted connections through the SSH transport.
Authentication and Internals
Choose an authentication strategy and understand how the client falls back when a method is unavailable.
Channel handler that wraps forwarded bytes in SSHChannelData.