Skip to content

DropshareApp/dropshare-selfhosted

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

4 Commits
 
 
 
 
 
 
 
 

Repository files navigation

Dropshare Self-Hosted Server

Host your own file sharing server for Dropshare with automatic HTTPS.

Fast Path

For experienced users — get up and running in 2 minutes:

# On your server (requires Docker)
git clone https://github.com/dropshareapp/dropshare-selfhosted.git
cd dropshare-selfhosted
./setup.sh              # Enter your domain, accept defaults
docker compose up -d    # Start the server

# Copy the private key to your Mac
scp user@server:~/dropshare-selfhosted/config/ssh/dropshare_key ~/.ssh/
chmod 600 ~/.ssh/dropshare_key

Then in Dropshare: Preferences → Connections → + → SFTP — use the settings shown by the setup script.


What You Get

  • SFTP server for secure file uploads from Dropshare
  • Web server (Caddy) for serving files with automatic HTTPS/TLS certificates
  • SSH key authentication for security (no passwords)
  • Simple setup with an interactive script

Prerequisites

Before you start, you need:

  1. A server (VPS, cloud instance, or home server) with:

    • Docker and Docker Compose installed
    • Ports accessible from the internet (defaults: 80, 443, 2222 — customizable during setup)
  2. A domain name pointing to your server's IP address

    • Example: files.yourdomain.com123.45.67.89
    • For local testing, you can use 127.0.0.1 or a local IP address

Installing Docker

If Docker is not already installed on your server, follow the instructions for your Linux distribution:

Ubuntu / Debian

# Update package index
sudo apt update

# Install prerequisites
sudo apt install -y ca-certificates curl gnupg

# Add Docker's official GPG key
sudo install -m 0755 -d /etc/apt/keyrings
curl -fsSL https://download.docker.com/linux/ubuntu/gpg | sudo gpg --dearmor -o /etc/apt/keyrings/docker.gpg
sudo chmod a+r /etc/apt/keyrings/docker.gpg

# Add the Docker repository (for Debian, replace 'ubuntu' with 'debian')
echo \
  "deb [arch=$(dpkg --print-architecture) signed-by=/etc/apt/keyrings/docker.gpg] https://download.docker.com/linux/ubuntu \
  $(. /etc/os-release && echo "$VERSION_CODENAME") stable" | \
  sudo tee /etc/apt/sources.list.d/docker.list > /dev/null

# Install Docker
sudo apt update
sudo apt install -y docker-ce docker-ce-cli containerd.io docker-buildx-plugin docker-compose-plugin

# Add your user to the docker group (logout and back in after this)
sudo usermod -aG docker $USER

Fedora

sudo dnf -y install dnf-plugins-core
sudo dnf config-manager --add-repo https://download.docker.com/linux/fedora/docker-ce.repo
sudo dnf install -y docker-ce docker-ce-cli containerd.io docker-buildx-plugin docker-compose-plugin
sudo systemctl start docker && sudo systemctl enable docker
sudo usermod -aG docker $USER

CentOS / RHEL / Rocky Linux / AlmaLinux

sudo yum install -y yum-utils
sudo yum-config-manager --add-repo https://download.docker.com/linux/centos/docker-ce.repo
sudo yum install -y docker-ce docker-ce-cli containerd.io docker-buildx-plugin docker-compose-plugin
sudo systemctl start docker && sudo systemctl enable docker
sudo usermod -aG docker $USER

Arch Linux

sudo pacman -S docker docker-compose
sudo systemctl start docker && sudo systemctl enable docker
sudo usermod -aG docker $USER

Verify Installation

Log out and back in, then verify:

docker --version
docker compose version

Quick Start

1. Clone and Setup

git clone https://github.com/dropshareapp/dropshare-selfhosted.git
cd dropshare-selfhosted
./setup.sh

The setup script will:

  • Ask for your domain name and ports
  • Generate secure SSH keys
  • Create all configuration files
  • Display connection settings for Dropshare

2. Start the Server

docker compose up -d

3. Get the SSH Private Key

The setup script generates an SSH keypair for authentication. You need to transfer the private key to your Mac to use with Dropshare.

Option A: Copy via SCP (from your Mac)

scp user@your-server:~/dropshare-selfhosted/config/ssh/dropshare_key ~/.ssh/dropshare_key
chmod 600 ~/.ssh/dropshare_key

Option B: Copy via clipboard (on the server)

cat config/ssh/dropshare_key

Then copy the output (including -----BEGIN/END----- lines) and save it to a file on your Mac, e.g., ~/.ssh/dropshare_key. Set permissions:

chmod 600 ~/.ssh/dropshare_key

Option C: Use SFTP client

Connect to your server with an SFTP client (like Transmit or Cyberduck) and download config/ssh/dropshare_key to your Mac.

4. Configure Dropshare

Open Dropshare preferences → Connections → Add new SFTP connection:

Setting Value
Protocol SFTP
Hostname your-domain.com:2222 (use your custom port if changed)
Username dropshare (or your custom username)
Authentication Private Key
Private Key Select the dropshare_key file from step 3
Upload Path /uploads/ (or your custom path)
URL to Path https://your-domain.com/ (include port if non-standard HTTPS)

Tip: The setup script displays the exact connection settings for your configuration. Use those values.

Architecture

┌─────────────────┐         ┌─────────────────┐
│   Dropshare     │  SFTP   │  SFTP Server    │
│   (your Mac)    │────────▶│ (default: 2222) │
└─────────────────┘         └────────┬────────┘
                                     │
                                     ▼
                            ┌─────────────────┐
                            │  Shared Volume  │
                            │   /uploads      │
                            └────────┬────────┘
                                     │
                                     ▼
┌─────────────────┐         ┌─────────────────┐
│   Browser /     │  HTTPS  │  Caddy Server   │
│   Recipients    │◀────────│ (default: 443)  │
└─────────────────┘         └─────────────────┘

File Structure

dropshare-selfhosted/
├── setup.sh                # Interactive setup script
├── README.md               # This file
├── templates/              # Template files
│   ├── docker-compose.yml      # Container orchestration template
│   ├── Caddyfile.template      # Caddy configuration template
│   └── .env.example            # Example environment variables
│
│ # Generated by setup.sh:
├── docker-compose.yml      # Copied from templates
├── .env                    # Your configuration
├── config/
│   ├── Caddyfile               # Generated Caddy config
│   ├── authorized_keys         # SSH public key for auth
│   ├── ssh/
│   │   ├── dropshare_key       # Private key (import to Dropshare)
│   │   ├── dropshare_key.pub   # Public key
│   │   └── ssh_host_*          # Server host keys
│   └── fail2ban/               # Fail2ban configuration
│       ├── filter.d/           # Custom filters
│       └── jail.d/             # Jail configuration
└── uploads/                # Your uploaded files

Commands

# Start the server
docker compose up -d

# Stop the server
docker compose down

# View logs
docker compose logs -f

# View specific service logs
docker compose logs -f sftp
docker compose logs -f caddy

# Restart after config changes
docker compose restart

Customization

Change Ports

Edit .env and change any of these, then restart:

  • SFTP_PORT - SFTP port (default: 2222)
  • HTTP_PORT - HTTP port (default: 80, needed for Let's Encrypt)
  • HTTPS_PORT - HTTPS port (default: 443)
docker compose down
docker compose up -d

Note: If you use a non-standard HTTPS port, you'll need to include it in your URLs (e.g., https://files.example.com:8443/).

Troubleshooting

Cannot connect via SFTP

  1. Check the server is running: docker compose ps
  2. Check firewall allows your SFTP port: sudo ufw allow 2222 (or your custom port)
  3. Check logs: docker compose logs sftp
  4. Verify the private key file permissions: chmod 600 ~/.ssh/dropshare_key

HTTPS not working

  1. Ensure your domain points to this server's IP
  2. Check ports 80 and 443 (or your custom ports) are open
  3. Check Caddy logs: docker compose logs caddy
  4. For local/IP addresses, the browser will warn about the self-signed certificate — this is expected

Permission denied on upload

Check the uploads directory permissions:

chmod 755 uploads

SSH key not accepted

  1. Ensure you're using the correct private key file (dropshare_key, not dropshare_key.pub)
  2. Check the key file has correct permissions: chmod 600 ~/.ssh/dropshare_key
  3. Verify the public key is in config/authorized_keys on the server

Security

Fail2ban Protection (Linux only)

The server includes optional fail2ban protection against brute-force attacks. It automatically bans IP addresses after repeated failed login attempts.

Note: Fail2ban only works on Linux servers. It requires access to Docker container logs and iptables, which aren't available on macOS or Windows.

Enable fail2ban on Linux:

docker compose --profile linux up -d

Default settings:

  • Max retries: 5 failed attempts
  • Find time: 10 minutes (600 seconds)
  • Ban time: 1 hour (3600 seconds)

Manage banned IPs:

# View banned IPs
docker compose exec fail2ban fail2ban-client status dropshare-sftp

# Unban an IP
docker compose exec fail2ban fail2ban-client set dropshare-sftp unbanip <IP>

# View fail2ban logs
docker compose logs fail2ban

Customize settings:

Edit config/fail2ban/jail.d/dropshare.local and restart:

docker compose restart fail2ban

Security Notes

  • SSH key authentication only (no passwords)
  • SFTP runs on port 2222 by default to avoid conflicts with system SSH (customizable)
  • Caddy automatically obtains and renews TLS certificates
  • Fail2ban protects against brute-force attacks
  • Files are publicly accessible once uploaded (by design for sharing)

License

MIT

About

Set up a self-hosted Dropshare storage

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages