zhaobang-ftpserver-nightly - Zhaobang.FtpServer 1.0.0

A package for hosting an FTP server, with authenticating and file managing customizable. Go to project site for usage example or executable version.

PM> Install-Package Zhaobang.FtpServer -Version 1.0.0 -Source https://www.myget.org/F/zhaobang-ftpserver-nightly/api/v3/index.json

Copy to clipboard

> nuget.exe install Zhaobang.FtpServer -Version 1.0.0 -Source https://www.myget.org/F/zhaobang-ftpserver-nightly/api/v3/index.json

Copy to clipboard

> dotnet add package Zhaobang.FtpServer --version 1.0.0 --source https://www.myget.org/F/zhaobang-ftpserver-nightly/api/v3/index.json

Copy to clipboard
<PackageReference Include="Zhaobang.FtpServer" Version="1.0.0" />
Copy to clipboard
source https://www.myget.org/F/zhaobang-ftpserver-nightly/api/v3/index.json

nuget Zhaobang.FtpServer  ~> 1.0.0
Copy to clipboard

> choco install Zhaobang.FtpServer --version 1.0.0 --source https://www.myget.org/F/zhaobang-ftpserver-nightly/api/v2

Copy to clipboard
Import-Module PowerShellGet
Register-PSRepository -Name "zhaobang-ftpserver-nightly" -SourceLocation "https://www.myget.org/F/zhaobang-ftpserver-nightly/api/v2"
Install-Module -Name "Zhaobang.FtpServer" -RequiredVersion "1.0.0" -Repository "zhaobang-ftpserver-nightly" 
Copy to clipboard

FtpServer

This repository consists of two projects: the library and the server. The library Zhaobang.FtpServer is an FTP library supporting .NET Standard 1.4 and .NET Standard 2.1. The server Zhaobang.FtpServer.Cli is an FTP server written on .NET Core 3.0.

Zhaobang.FtpServer

A FTP library for .NET Standard 1.4 and .NET Standard 2.1. It can be used in .NET Core and UWP projects. It supports customized authenticator, file provider, and data connection provider.

Build Status: Build status

Get stable release: Get stable release

Get testing release: Get testing release

Simple Usage

The server allows anonymous login, and users can read and write in a public directory.

To start the server

// using System.Net;
// using System.Threading;
// using Zhaobang.FtpServer;

var endPoint = new IPEndPoint(IPAddress.Any, 21);
// To accept IPv6 connection, replace "IPAddress.Any" with "IPAddress.IPv6Any"
// You need 2 FtpServer instances to accept both IPv4 and IPv6 connectins

var baseDirectory = "C:\\FtpServer";
var server = new FtpServer(endPoint, baseDirectory);

var cancelSource = new CancellationTokenSource();
var runResult = server.RunAsync(cancelSource.Token);

To stop the server

cancelSource.Cancel(); // Stop accepting new clients
await runResult; // Wait until last client quits

Customization

The server allows developer to use customized authentication, file provider, data connection and stream encrytion.

Implement Zhaobang.FtpServer.File.IFileProviderFactory to use custom file system. The default one is SimpleFileProvider, which allow all users to read and write in a single directory.

Implement Zhaobang.FtpServer.Connections.IDataConnectionFactory to use custom data connection, (for example, establish data connection from another server). The default one is LocalDataConnectionFactory, which establish data connection from local server. Use SslLocalDataConnectionFactory (available only on .NET Standard 2.1) to support TLS on data connection.

Implement Zhaobang.FtpServer.Authenticate.IAuthenticator to use custom authentication. The default one is AnonymousAuthenticator, which only allows anonymous logins.

(Optional) (since version 2.1.0) Provide an implementation of Zhaobang.FtpServer.Connections.IControlConnectionSslFactory to support TLS on control connection. An implementation class ControlConnectionSslFactory is provided on the .NET Standard 2.1 version.

Use the following to start your customized server:

var server = new FtpServer(
    localEP,
    new MyFileProviderFactory(),
    new MyDataConnectionFactory(),
    new MyAuthenticator(),
    new MyControlConnectionSslFactory()
);
// the remaining is same as simple use

FTP over TLS support (since version 2.1.0)

TLS on data connection is enabled when IDataConnection instances created by IDataConnectionDataFactory instance implement interface ISslDataConnection.

TLS on control connection is enabled when an instance of IControlConnectionSslFactory is passed to the constructor of FtpServer.

The .NET Standard 2.1 version has out-of-box FTP over TLS support. Example:

var fileProviderFactory = new SimpleFileProviderFactory(config.BaseDirectory);
var dataConnectionFactory = new SslLocalDataConnectionFactory(certificate);
var authenticator = new AnonymousAuthenticator();
var controlConnectionSslFactory = new ControlConnectionSslFactory(certificate);
var server = new FtpServer(ep, fileProviderFactory, dataConnectionFactory, authenticator, controlConnectionSslFactory);

The .NET Standard 1.4 version requires your own implementation of those classes. You can refer to the source code for a sample implementation.

Zhaobang.FtpServer.Cli

The server is a simple FTP server that utilizes the library.

Feature

Set up a server for anonymous read and write.

Usage

Download a release and run, then a default configuration "RunConfig.xml" will be created. The server will listen for IPv4 and IPv6 connections, and allow anonymous users to read and write at the running directory.

Configuration

The config file is at ./RunConfig.xml (depends on where you run the program). If it's not found, a default one will be created.

EndPoints

The local end points to listen at different addresses and ports. Note: Address and Port are the value on the server.

BaseDirectory

The FTP base directory.

CertificatePath

The path to a PKCS7 certificate file to support FTP over TLS. Keep it empty to disable FTP over TLS.

CertificatePassword

The password of the certificate file.

Default configuration file

The default content of RunConfig.xml:

<?xml version="1.0"?>
<RunConfig xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema">
  <EndPoints>
    <IPEndPointData Address="0.0.0.0" Port="21" />
    <IPEndPointData Address="::" Port="21" />
  </EndPoints>
  <BaseDirectory>./</BaseDirectory>
  <CertificatePath />
  <CertificatePassword />
</RunConfig>

2.0.0: Add extensibility for supporting more protocals Add support of IPv6 Support LIST command for a file Structure in 1.0.0 are changed for better extensibility Bug fix

  • .NETStandard 1.4
    • NETStandard.Library (>= 1.6.1)
  • .NETStandard 1.4: 1.4.0.0

Owners

Huang, Zhaoquan

Authors

Zhaoquan Huang

Project URL

https://github.com/ZhaobangChina/FtpServer

License

MIT

Tags

FTP

Info

249 total downloads
18 downloads for version 1.0.0
Download (27.59 KB)
Found on the current feed only

Package history

Version Size Last updated Downloads Mirrored?
2.1.3-build44 69.81 KB Mon, 26 Jan 2026 12:51:30 GMT 0
2.1.3-build43 69.8 KB Sun, 14 Dec 2025 02:26:44 GMT 0
2.1.3-build42 69.76 KB Sat, 13 Dec 2025 10:51:03 GMT 1
2.1.3-build41 68.32 KB Tue, 09 Dec 2025 12:57:53 GMT 2
2.1.3-build40 63.93 KB Mon, 08 Dec 2025 05:01:08 GMT 3
2.1.3-build39 63.76 KB Sat, 06 Dec 2025 14:36:06 GMT 2
2.1.3-build38 63.76 KB Tue, 02 Dec 2025 04:54:18 GMT 3
2.1.3-build37 63.76 KB Tue, 02 Dec 2025 01:31:43 GMT 5
2.1.3-build36 64.14 KB Sun, 16 Apr 2023 12:44:57 GMT 20
2.1.2-build35 64.11 KB Sun, 16 Apr 2023 12:35:08 GMT 13
2.1.2-build34 64.05 KB Sat, 13 Jun 2020 13:01:49 GMT 27
2.1.0-build33 64.03 KB Sat, 13 Jun 2020 12:29:52 GMT 10
2.1.0-build32 64.03 KB Tue, 14 Apr 2020 05:38:21 GMT 11
2.1.0-build31 64.02 KB Tue, 14 Apr 2020 05:20:35 GMT 14
2.1.0-build30 63.98 KB Tue, 14 Apr 2020 04:14:01 GMT 15
2.1.0-build29 63.86 KB Thu, 03 Oct 2019 08:28:01 GMT 10
2.1.0-build28 62.81 KB Thu, 03 Oct 2019 07:17:46 GMT 13
2.0.1-build28 29.5 KB Thu, 03 Oct 2019 06:53:54 GMT 17
2.0.1-build27 29.61 KB Fri, 08 Dec 2017 09:37:23 GMT 12
2.0.1-build21 28.58 KB Wed, 06 Dec 2017 01:32:36 GMT 14
2.0.1-build20 27.67 KB Sun, 29 Oct 2017 03:17:30 GMT 12
2.0.0 27.66 KB Sun, 29 Oct 2017 03:03:22 GMT 16
2.0.0-build19 27.66 KB Sat, 28 Oct 2017 15:42:12 GMT 11
1.0.0 27.59 KB Sat, 28 Oct 2017 15:27:32 GMT 18