FluentFTP Documentation

repository·master·Indexed 25 days ago

https://github.com/robinrodricks/fluentftp

A high-performance, fully managed FTP and FTPS client library for .NET and .NET Standard. It supports FTP, FXP, and FTPS (including TLS 1.3), featuring full async/await support, recursive directory management, and file hashing. Compatible with .NET Framework 4.6.2+, .NET Core/Modern .NET 7.0-9.0, and .NET Standard 2.0/2.1. Note: SFTP is not supported.

Tokens
2.9K
Snippets
10
Records
18
Agent score
85%

What's inside FluentFTP

  1. Overview of FluentFTP features

    master

    FluentFTP is a fully managed FTP and FTPS client library for .NET and .NET Standard, optimized for speed. It is written entirely in C# with no external dependencies.

    Key capabilities include:

    • Protocols: Full support for FTP, FXP (server-to-server), FTPS (including TLS 1.3 and client certificates), and FTPS Proxies.
    • File Management: Recursive directory listing/deletion, progress tracking for uploads/downloads, directory synchronization (mirror/update modes), FXP transfers, rule-based whitelisting/blacklisting, and file hashing/checksum verification (MD5, CRC32, SHA-1, SHA-256, SHA-512).
    • Security: Protection against command injection, directory traversal, encoding bypasses, and parser confusion. Supports explicit and implicit SSL connections.
    • Asynchronous Support: Full async/await support for all operations, including IAsyncEnumerable for GetListing methods and CancellationToken support for cancellation and timeouts.
    • Extensibility: Support for custom logging via ILogger, custom FTP servers, custom FtpRule filtering, custom FtpClientProxy types, and custom directory listing parsers.
    • Note: SFTP (FTP over SSH) is not supported. Use SSH.NET for SFTP requirements.
  2. Install FluentFTP via NuGet

    master

    FluentFTP and its related packages are available on NuGet. You can install the core library or specialized packages for logging and GnuTLS support.

    Core Packages:

    • FluentFTP: The main client library.
    • FluentFTP.Logging: For enhanced logging capabilities.
    • FluentFTP.GnuTLS: For FTPS connections using GnuTLS.
  3. Verify platform and .NET compatibility

    master

    FluentFTP is compatible with .NET and .NET Standard/.NET Core. It provides specific binaries for the following targets:

    • .NET Framework: 4.6.2, 4.7.2
    • .NET Core/Modern .NET: 7.0, 8.0, 9.0
    • .NET Standard: 2.0, 2.1

    Additionally, via .NET Standard, it supports:

    • Mono 4.6
    • Xamarin.iOS 10.0
    • Xamarin.Android 10.0
    • Universal Windows Platform 10.0
  4. Find usage examples for FluentFTP

    master

    To learn how to use FluentFTP, you can refer to the following resources:

    • Quick Start: A C# quick start example is available in the project Wiki.
    • C# Examples: Extensive examples for all methods are located in the FluentFTP.CSharpExamples directory.
    • VB.NET Examples: Extensive examples for all methods are located in the FluentFTP.VBExamples directory.
  5. Deploy glftpd using Docker Compose

    master

    You can deploy the glftpd service using the provided docker-compose.yml configuration. This setup builds the service from the local context using the host network and maps specific ports for FTP control and data transfer. It also uses volumes to persist user home directories and logs on the host machine.

    services:
      glftpd:
        build:
          context: .
          network: host
        restart: unless-stopped
        ports:
          - 0.0.0.0:20:20
          - 0.0.0.0:21:21
          - 21100-21110:21100-21199
        volumes:
          - ./home:/home/glftpd
          - ./logs:/var/log/glftpd
  6. Deploy Apache via Docker Compose

    master

    The apache service can be deployed using Docker Compose. It is configured to use the host network and maps specific ports for FTP traffic (20, 21) and a passive port range (21100-21199). It also uses volumes to persist the /home/apache and /var/log/apache directories to the host.

    services:
      apache:
        build:
          context: .
          network: host
        restart: unless-stopped
        restart: always
        network_mode: "host"
        ports:
    	- 0.0.0.0:20:20
    	- 0.0.0.0:21:21
    	- 21100-21199:21100-21199
        volumes:
    	- ./home:/home/apache
    	- ./logs:/var/log/apache
  7. Configure Pure-FTPd via docker-compose.yml

    master

    The pureftpd service in the FluentFTP.Dockers/pureftpd directory can be deployed using Docker Compose. It uses host networking and maps specific ports for FTP control and passive data transfers. Data and logs are persisted via local volume mounts.

    services:
      pureftpd:
        build:
          context: .
          network: host
        restart: unless-stopped
        restart: always
        network_mode: "host"
        ports:
          - 0.0.0.0:20:20
          - 0.0.0.0:21:21
          - 21100-21199:21100-21199
        volumes:
          - ./home:/home/pureftpd
          - ./logs:/var/log/pureftpd
  8. Configure the vsftpd Docker service

    master

    The vsftpd service in the FluentFTP.Dockers/vsftpd/docker-compose.yml file provides a containerized FTP server for testing. It maps standard FTP ports and a passive port range, and uses local directories for user home folders and logs.

    Port Mappings:

    • 20: FTP Data port
    • 21: FTP Control port
    • 21100-21199: Passive port range

    Volume Mappings:

    • ./home: Mapped to /home/vsftpd (User home directories)
    • ./logs: Mapped to /var/log/vsftpd (Service logs)
    services:
      vsftpd:
        build:
          context: .
          network: host
        restart: unless-stopped
        restart: always
        ports:
          - 0.0.0.0:20:20
          - 0.0.0.0:21:21
          - 21100-21199:21100-21199
        volumes:
          - ./home:/home/vsftpd
          - ./logs:/var/log/vsftpd
  9. Configure the bftpd Docker service

    master

    The bftpd service can be deployed using Docker Compose. It supports host networking during the build phase, automatic restart policies, specific port mappings for FTP and passive mode, and volume mounts for user data and logs.

    Port Mappings:

    • 20: FTP Data port
    • 21: FTP Control port
    • 21100-21199: Passive mode port range

    Volume Mounts:

    • ./home maps to /home/bftpd (User home directories)
    • ./logs maps to /var/log/bftpd (Service logs)
    services:
      bftpd:
        build:
          context: .
          network: host
        restart: unless-stopped
        restart: always
        ports:
          - 0.0.0.0:20:20
          - 0.0.0.0:21:21
          - 21100-21199:21100-21199
        volumes:
          - ./home:/home/bftpd
          - ./logs:/var/log/bftpd
  10. Configure ProFTPD via Docker Compose

    master

    The proftpd service can be deployed using Docker Compose. It uses host networking and exposes specific ports for FTP control and passive data transfers. Local directories can be mapped to the container for persistent user home directories and log storage.

    services:
      proftpd:
        build:
          context: .
          network: host
        restart: unless-stopped
        restart: always
        network_mode: "host"
        ports:
          - 0.0.0.0:20:20
          - 0.0.0.0:21:21
          - 21100-21199:21100-21199
        volumes:
          - ./home:/home/proftpd
          - ./logs:/var/log/proftpd