Golang based autonomous FTP server with SFTP, S3, Dropbox, and Google Drive connectors.
Golang based autonomous FTP server with SFTP, S3, Dropbox, and Google Drive connectors.
This FTP server is a gateway between old-school FTP devices and modern cloud based file systems, using the afero's Fs interface and acting as a reference implementation of the ftpserverlib.
At the current stage, supported backend are:
And with those are supported common parameters to switch them to read-only, enable login access, or use a temporary directory file (see doc).
These features are brought by ftpserverlib itself:
Fetch a binary for your platform from the latest release
and run it. Archives are named ftpserver--- and are provided for Linux, macOS and Windows on
amd64 and arm64, plus armv6/armv7 for Linux (Raspberry Pi and friends).
go install github.com/fclairamb/ftpserver@main
ftpserver &There's also a containerized version of the server (31MB, based on alpine).
# Creating a directory
mkdir -p files
# Starting the sample FTP server
docker run --rm -d -p 2121-2130:2121-2130 -v $(pwd)/files:/tmp -v $(pwd):/app fclairamb/ftpserver# docker-compose.yml
version: '3.3'
services:
ftpserver:
ports:
- '2121-2130:2121-2130'
volumes:
- ./files:/tmp
- .:/app
image: fclairamb/ftpserverdocker-compose up -dThis is a quick way to see if it's working correctly:
# Download some file
[ -f kitty.jpg ] || (curl -o kitty.jpg.tmp https://placekitten.com/2048/2048 && mv kitty.jpg.tmp kitty.jpg)
# Upload it to the server
curl -v -T kitty.jpg ftp://test:test@localhost:2121/
# Download it back
curl ftp://test:test@localhost:2121/kitty.jpg -o kitty2.jpg
# Compare it
diff kitty.jpg kitty2.jpgIf you don't create a ftpserver.json file, one will be created for you.
Here is a sample config file:
…You can generate the TLS key pair files with the following command:
openssl req -new -newkey rsa:4096 -x509 -sha256 -days 365 -nodes -out cert.pem -keyout key.pemThe sftp backend connects to an upstream SSH/SFTP server and verifies its host key to
protect against man-in-the-middle attacks. You must configure exactly one of the following
params:
known_hosts: path to an OpenSSH known_hosts file containing the upstream server's key
(e.g. generated with ssh-keyscan -H host >> known_hosts).host_key: the upstream server's public key pinned inline, in authorized_keys /
known_hosts line format (e.g. ssh-ed25519 AAAA...).insecure_ignore_host_key: set to "true" to disable host key verification entirely.
This is unsafe (it exposes the connection to man-in-the-middle attacks) and should only
be used in trusted networks or for testing.If none of these is set, the connection is refused.
No open issues yet, or sync has not completed.