CosmosFTP is an FTP server made in C# for the Cosmos operating system construction kit.
Port of a C written Epitech project: NWP_myftp_2019
Add the package to your kernel .csproj:
<ItemGroup>
<PackageReference Include="Cosmos.Network.Ftp" Version="2.0.0" />
</ItemGroup>The kernel needs networking and storage (CosmosEnableNetwork, CosmosEnableStorage, both on by default), an IP configuration (DHCP or static) and a mounted filesystem. Listen() serves every client on the calling thread until Close() is called, so start it on a thread of its own to keep your shell:
using System.Threading;
using Cosmos.Network.Ftp;
FtpServer server = new("/mnt")
{
// Optional: left out, any user name logs in with any password.
Authenticate = (user, password) => user == "cosmos" && password == "cosmos",
// Optional: one line per connection, command and failure.
Log = message => Cosmos.Kernel.System.Diagnostics.Log.WriteString(message + "\n"),
};
new Thread(server.Listen).Start();
// Later, to stop serving:
server.Close();Passive mode is the one to use. Each passive transfer listens on a port from PassivePortMin to PassivePortMax (50000 to 50009 by default). Active mode (PORT, EPRT) only connects back to the address the client is connected from, so it does not work through NAT.
With QEMU user-mode networking, forward the control port and every passive port to the guest. With the Cosmos CLI:
cosmos run --hostfwd tcp::2121-:21 --hostfwd tcp::50000-:50000 --hostfwd tcp::50001-:50001 # and so on, up to 50009Contributions, issues and feature requests are welcome!
Feel free to check issues page.
Copyright © 2022-2026 CosmosOS.
This project is BSD Clause 3 licensed.