Loading repository data…
Loading repository data…
Guichaguri / repository
A lightweight, simple FTP server. Pure Java, no dependencies.
A transparent discovery signal based on current public GitHub metadata.
This score does not audit code, security, maintainers, documentation quality, or suitability. Verify the repository and its current documentation before adoption.
A lightweight, simple FTP server. Pure Java, no libraries.
Although it's named "minimal", it supports a bunch of features:
The required minimum implementation is already done, however, there are still commands that can be implemented.
MinimalFTP is published on Maven Central.
<dependency>
<groupId>com.guichaguri</groupId>
<artifactId>minimalftp</artifactId>
<version>1.0.7</version>
</dependency>
implementation 'com.guichaguri:minimalftp:1.0.7'
Check out more examples here :)
// Uses the current working directory as the root
File root = new File(System.getProperty("user.dir"));
// Creates a native file system
NativeFileSystem fs = new NativeFileSystem(root);
// Creates a noop authenticator, which allows anonymous authentication
NoOpAuthenticator auth = new NoOpAuthenticator(fs);
// Creates the server with the authenticator
FTPServer server = new FTPServer(auth);
// Start listening synchronously
server.listenSync(21);
The FTP protocol has two concepts of TCP connections:
This is the main FTP server, the one that usually listens on port 21.
The control connection is the one that receives commands for authentication and file manipulation. It also negotiates the data connection for file listing and transfer.
This is a secondary connection that is used for file list and transfer (both downloading and uploading).
The FTP protocol supports two modes:
Those passive mode servers that MinimalFTP creates each have a random port in the ephemeral range. You should either configure your firewall to allow incoming TCP connections to the ephemeral port range, or disable passive mode:
// Keeps only the Active Mode enabled (not recommended)
server.setPassiveModeEnabled(false);
Keeping only the active mode enabled is not recommended, as it can cause connectivity problems due to the user having firewall issues.