Pure .NET · no native dependencies

An embeddable SSH & SFTP server for .NET

Host a secure SFTP server from your own application in a few lines of C#. A complete SSH-2 implementation with its own cryptography — bring your own authentication and storage.

.NET 8+ · C#
Zero native libs
Tested against OpenSSH 9.6
Program.cs
using Rst.Ssh;
using Rst.Ssh.Sftp;

await using var server = SshServer.CreateBuilder()
    .Listen(22)
    .Configure(o => o.HostKeys.Add(hostKey))
    .UsePasswordAuthentication((user, pw) =>
        user == "demo" && pw == "demo")
    .AddSftp(sftp => sftp.FileSystemFactory = s =>
        ValueTask.FromResult<ISftpFileSystem>(
            new LocalFileSystem($"/srv/sftp/{s.User!.Identity!.Name}")))
    .Build();

await server.StartAsync();
// Your app answers "is this allowed?" — the library does the rest.
What it is

A server component, not a daemon

In the spirit of an embeddable file server: you don't configure a separate service — you add a NuGet reference and run the server inside your own process. Authentication, storage and policy are plain C# callbacks, so the SFTP endpoint fits your existing identity system and data, wherever it lives.

🧩

Embeddable

Runs in-process in your ASP.NET, worker or desktop app. No external SSH daemon, no shell accounts.

🔐

Own cryptography

Transport, key exchange and host keys built on the .NET BCL plus a self-contained Curve25519/Ed25519 implementation. No third-party crypto.

🗂️

Your storage

Implement ISftpFileSystem over local disk, object storage, a database or anything else. A local-directory backend ships in the box.

🧾

Your auth

Password and public-key auth via callbacks or ISshAuthenticator. Multi-factor, attempt limits and login timeouts included.

🪝

Events & middleware

Connection and SFTP events (with veto) plus an ASP.NET-style pipeline to log, throttle or block operations.

⚡

Modern & fast

AES-GCM/CTR ciphers, strict KEX (Terrapin mitigation), flow control in both directions and rekeying.

Protocol support

Everything a modern SFTP client expects

Tested against OpenSSH 9.6 (ssh and sftp) across every combination of the algorithms below.

Transport
Binary packet protocol, strict KEX (Terrapin mitigation), client- and server-initiated rekey, packet size limits
Key exchange
curve25519-sha256 · ecdh-sha2-nistp256/384/521
Host keys
ssh-ed25519 · ecdsa-sha2-nistp256/384/521 · rsa-sha2-256/512
Ciphers
aes128/256-gcm@openssh.com · aes128/192/256-ctr
MACs
hmac-sha2-256/512 (+ -etm@openssh.com)
Authentication
Password & public-key (ed25519, ecdsa, rsa-sha2) · attempt limit · failure delay · login timeout · multi-factor
SFTP
Version 3 plus posix-rename, statvfs, fsync and limits (@openssh.com)
Connection
Session channels, flow control both directions, subsystem, optional exec
Examples

From a password check to a full policy

Start minimal, then layer on public keys, per-user file systems and event hooks — all in ordinary C#.

public-key auth
// The library verifies the signature; you decide if the key is allowed.
builder.UsePublicKeyAuthentication((user, key) =>
    authorized.Contains((user, key.Fingerprint)));

// key.Algorithm → "ssh-ed25519", key.Blob, key.Fingerprint (SHA256:…)
events & veto
// React to — or block — operations as they happen.
sftp.OnUpload(e =>
{
    if (e.Path.EndsWith(".exe"))
        e.Reject("Executables are not allowed");
});

sftp.OnDownload(e => log.LogInformation("get {Path}", e.Path));

Full documentation and more samples are in the GitHub repository.

Trusted by

Teams building on sftpserver.net

Pricing

Free for small teams. Fair for the rest.

Licensed under the PolyForm Small Business License 1.0.0 with commercial licensing for larger organizations.

Small business
Free
Including commercial use
  • Fewer than 100 people (employees & contractors)
  • Under USD 1,000,000 annual revenue
  • Full source code, no feature limits
  • Use in personal and internal projects

PolyForm Small Business is a source-available licence, not an OSI-approved open-source licence. The LICENSE file is binding; this page is a summary and not legal advice.

Obtain a licence

Over the small-business thresholds, or need a tailored commercial agreement? Get in touch and we'll sort out the right licence for your organization.

Prefer email: licensing@sftp-server.net