A lightweight, self-hosted web application for backing up personal files from any device. Access your files anywhere through a modern browser UI (HTTP/HTTPS) or push them from any machine using the bundled rsync helper script over SSH.
| Feature | Details |
|---|---|
| Web UI | Directory browser, upload (drag & drop), download, rename, delete, create folders |
| Drag & Drop upload | Select multiple files at once |
| REST-style API | GET /api/list/<path> — JSON directory listing for scripted access |
| Session auth | Username + password login protecting all routes |
| Docker | Single docker compose up deploys the app + Nginx reverse-proxy |
| HTTPS | Let's Encrypt / Certbot integration out of the box |
| rsync helper | scripts/sync.sh pushes local folders to the server over SSH |
| Health-check | GET /health — used by Docker and load-balancers |
# 1. Clone & enter the repo
git clone https://github.com/DarkModder33/FTP_backup.git
cd FTP_backup
# 2. Create a virtual environment and install dependencies
python -m venv .venv
source .venv/bin/activate # Windows: .venv\Scripts\activate
pip install -r requirements.txt
# 3. Copy the example env file and set your credentials
cp .env.example .env
# → edit .env: set SECRET_KEY, ADMIN_USERNAME, ADMIN_PASSWORD
# 4. Run
python app.pyOpen http://localhost:5000 and log in with the credentials you set.
- A Linux server (Ubuntu 22.04+ recommended) with Docker + Docker Compose installed
- DNS A record for
tradehax.net(and optionallywww.tradehax.net) pointing to the server IP - Ports 80 and 443 open in your firewall
rsync -avz ./ user@tradehax.net:/opt/ftpbackup/cd /opt/ftpbackup
cp .env.example .env
nano .env # set SECRET_KEY, ADMIN_USERNAME, ADMIN_PASSWORD# Temporarily bring up Nginx on port 80 for the ACME challenge
docker compose up -d nginx
docker compose run --rm certbot certonly \
--webroot -w /var/www/certbot \
-d tradehax.net -d www.tradehax.net \
--email your@email.com --agree-tos --non-interactivedocker compose up -dThe site is now live at https://tradehax.net.
Certbot auto-renews certificates every 12 hours. Nginx will pick up new certificates on the next reload. You can trigger a manual reload with:
docker compose exec nginx nginx -s reloadThe scripts/sync.sh helper wraps rsync to push a local folder to the server.
# Make the script executable (once)
chmod +x scripts/sync.sh
# Push your Documents folder into a "documents" directory on the server
./scripts/sync.sh ~/Documents documents
# Dry-run first to preview what will be transferred
./scripts/sync.sh --dry-run ~/Photos photos
# Override server settings inline
BACKUP_HOST=tradehax.net BACKUP_USER=myuser ./scripts/sync.sh ~/Music musicDefault environment variables:
| Variable | Default | Description |
|---|---|---|
BACKUP_HOST |
tradehax.net |
Server hostname or IP |
BACKUP_USER |
$USER (current) |
SSH username |
BACKUP_PORT |
22 |
SSH port |
BACKUP_DEST |
/data/uploads |
Remote base directory |
Tip: Add an SSH key pair (
ssh-keygen) and copy your public key to the server (ssh-copy-id user@tradehax.net) so the sync script runs without a password prompt.
Files are stored under /data/uploads on the server (mapped to the uploads Docker volume). To browse or manage files over SSH:
ssh user@tradehax.net
ls /data/uploadsOr mount the volume directly from the host:
# Find the volume mount point
docker volume inspect ftpbackup_uploadsSee .env.example for all available options.
| Variable | Default | Description |
|---|---|---|
SECRET_KEY |
random | Flask session secret — must be set in production |
ADMIN_USERNAME |
admin |
Login username |
ADMIN_PASSWORD |
changeme |
Login password — must be changed |
UPLOAD_FOLDER |
./uploads |
Path where files are stored |
MAX_UPLOAD_BYTES |
10 GB | Maximum upload size |
SESSION_LIFETIME |
28800 s | Session cookie lifetime |
ALLOW_PUBLIC_READ |
false |
Allow unauthenticated read-only access |
FLASK_DEBUG |
false |
Never enable in production |
FTP_backup/
├── app.py # Flask application
├── config.py # Configuration (reads from env vars)
├── requirements.txt # Python dependencies
├── Dockerfile # Container image
├── docker-compose.yml # Multi-service stack (app + nginx + certbot)
├── .env.example # Environment variable template
├── nginx/
│ ├── nginx.conf # Main Nginx config
│ └── conf.d/
│ └── tradehax.conf # Virtual host for tradehax.net (HTTP→HTTPS + proxy)
├── scripts/
│ └── sync.sh # rsync helper for client-side backups
├── static/
│ ├── css/app.css # Stylesheet
│ ├── js/app.js # Client-side JavaScript
│ └── favicon.svg
├── templates/
│ ├── base.html # Base layout
│ ├── login.html # Login page
│ └── browse.html # File browser
└── uploads/ # Local dev storage (git-ignored)
- Always set a strong, unique
SECRET_KEYandADMIN_PASSWORDin your.envfile. - The app runs as a non-root user inside Docker.
- TLS is required in production — the Nginx config redirects all HTTP traffic to HTTPS.
- Path traversal is prevented: all file operations are validated to stay within
UPLOAD_FOLDER. - Files are saved with
werkzeug.utils.secure_filenameto sanitise uploaded filenames.