SSH.NET lets .NET programs run SSH commands, transfer files, forward ports, and open shells over SSH-2.
Overview
SSH.NET is a Secure Shell (SSH-2) client library for .NET, described as optimized for parallelism. Applications reference NuGet packages and use types such as SshClient and SftpClient to connect, authenticate, and exchange data with remote hosts.
Synchronous and asynchronous APIs run remote commands, upload and download via SFTP, and copy files with SCP. Port forwarding covers remote, dynamic, and local modes. ShellStream provides an interactive terminal channel. Authentication supports passwords, public keys in many PEM and PuTTY formats, keyboard-interactive flows including multi-factor, and OpenSSH certificates for several key types.
Connections can traverse SOCKS4, SOCKS5, or HTTP proxies. The library lists supported cipher, key exchange, host key, MAC, and compression algorithms including modern options such as chacha20-poly1305 and mlkem768x25519-sha256. Target frameworks include .NET Framework 4.6.2 and newer, .NET Standard 2.0, and recent .NET versions per the project docs.
Usage examples in the documentation show constructing clients with host, username, and PrivateKeyFile, then calling Connect, RunCommand, UploadFile, or ListDirectory as needed.
Key features
- Sync and async SSH commands
- SFTP and SCP file transfer
- Local and remote port forwarding
- Interactive ShellStream terminal
- Multiple private key formats
- SOCKS and HTTP proxy support
- Broad encryption and key exchange support
- SshClient and SftpClient APIs
Use cases
- Automated remote administration
- SFTP file sync in .NET apps
- SSH tunneling through proxies
- Embedded shell sessions