Skip to content
Portable FTP server written in .NET
C#
Branch: master
Clone or download
Permalink
Type Name Latest commit message Commit time
Failed to load latest commit information.
.github Disable github for now Jul 3, 2019
docfx_project Removed 2.x-specific code Jul 1, 2019
docs Regenerated documentation Jul 1, 2019
samples Switch from IFtpUser to ClaimsPrincipal Aug 23, 2019
src OPTS UTF8 ON and OPTS UTF8 NLST enable UTF-8 for all situations Sep 4, 2019
test/FubarDev.FtpServer.Tests Custom integration test for issue #30 Oct 11, 2019
third-party Moved GnuSslStream into its own shared project May 29, 2019
.dockerignore Prepare for docker Jun 2, 2019
.editorconfig JSON with indent size 2 May 17, 2019
.gitattributes Initialisieren Sie das Commit, um ".gitIgnore"- und ".gitAttribute"-S… Oct 6, 2015
.gitignore Refactored test application to use a configuration file. May 17, 2019
DotNetSdkMono.props Cleanup May 24, 2018
FubarDev.FtpServer.ruleset Janitory work Apr 9, 2018
FubarDev.FtpServer.sln Added sample for "generic" and ASP.NET Core hosts Jun 28, 2019
FubarDev.FtpServer.sln.DotSettings Why is this required on one PC, but not on another? Jun 3, 2019
FubarDev.FtpServer.v3.ncrunchsolution New authorization actions and support for per-account directory config May 2, 2019
GitVersion.yml Next version is 3.0 Jan 23, 2019
Global.props Conversion to nullable reference types Aug 17, 2019
GlobalAssemblyInfo.cs New authorization actions and support for per-account directory config May 2, 2019
LICENSE.md - Added NuGet package projects Oct 6, 2015
PackageLibrary.props Updates for SourceLink Aug 17, 2019
README.md Fixed README May 8, 2019
stylecop.json Janitory work Apr 9, 2018

README.md

Portable FTP server

Build status

This FTP server is written as .NET Standard 2.0 library and has an abstract file system which allows e.g. Google Drive as backend.

License

The library is released under the MIT license.

Support the development

Patreon

Prerequisites

Compilation

  • Visual Studio 2019 / C# 8.0

Using

  • Visual Studio 2019
  • .NET Standard 2.0 (everything except sample application, PAM authentication)
  • .NET Core 3.0 (sample application, PAM authentication)

NuGet packages

Package name Description Badge
FubarDev.FtpServer Core library FubarDev.FtpServer
FD.FS.Abstractions Basic types FubarDev.FtpServer.Abstractions
FD.FS.FileSystem.DotNet System.IO-based file system FubarDev.FtpServer.FileSystem.DotNet
FD.FS.FileSystem.GoogleDrive Google Drive as file system FubarDev.FtpServer.FileSystem.GoogleDrive
FD.FS.FileSystem.InMemory In-memory file system FubarDev.FtpServer.FileSystem.InMemory
FD.FS.FileSystem.Unix Unix file system FubarDev.FtpServer.FileSystem.Unix
FD.FS.MembershipProvider.Pam PAM membership provider FubarDev.FtpServer.MembershipProvider.Pam

Example FTP server

Creating the project

dotnet new console
dotnet add package FubarDev.FtpServer.FileSystem.DotNet
dotnet add package FubarDev.FtpServer
dotnet add package Microsoft.Extensions.DependencyInjection

Contents of Main in Program.cs

// Setup dependency injection
var services = new ServiceCollection();

// use %TEMP%/TestFtpServer as root folder
services.Configure<DotNetFileSystemOptions>(opt => opt
    .RootPath = Path.Combine(Path.GetTempPath(), "TestFtpServer"));

// Add FTP server services
// DotNetFileSystemProvider = Use the .NET file system functionality
// AnonymousMembershipProvider = allow only anonymous logins
services.AddFtpServer(builder => builder
    .UseDotNetFileSystem() // Use the .NET file system functionality
    .EnableAnonymousAuthentication()); // allow anonymous logins

// Configure the FTP server
services.Configure<FtpServerOptions>(opt => opt.ServerAddress = "127.0.0.1");

// Build the service provider
using (var serviceProvider = services.BuildServiceProvider())
{
    // Initialize the FTP server
    var ftpServerHost = serviceProvider.GetRequiredService<IFtpServerHost>();

    // Start the FTP server
    ftpServerHost.StartAsync(CancellationToken.None).Wait();
    
    Console.WriteLine("Press ENTER/RETURN to close the test application.");
    Console.ReadLine();
    
    // Stop the FTP server
    ftpServerHost.StopAsync(CancellationToken.None).Wait();
}
You can’t perform that action at this time.