-
Notifications
You must be signed in to change notification settings - Fork 0
SFTP
Beau Barker edited this page Oct 11, 2025
·
6 revisions
Generate public and private keys for the host (use no passphrase):
mkdir -p keys/{host,user}
ssh-keygen -t ed25519 -f keys/host/ssh_host_ed25519_key < /dev/null
ssh-keygen -t rsa -b 4096 -f keys/host/ssh_host_rsa_key < /dev/nullPut your public user key(s) in keys/user.
Add an sftp service:
app/compose.yaml:
sftp:
image: atmoz/sftp
command: user:pass:1001
ports:
- "2222:22"
volumes:
- ./keys/host/ssh_host_ed25519_key:/etc/ssh/ssh_host_ed25519_key:ro
- ./keys/host/ssh_host_rsa_key:/etc/ssh/ssh_host_rsa_key:ro
- ./keys/user:/home/user/.ssh/keys:ro
- sftp_data:/home/user/upload:rwAnd a volume:
volumes:
sftp_data:Also add the sftp_data volume to the caddy service:
app/compose.yaml
services:
caddy:
volumes:
- sftp_data:/upload:roAdd to the Caddy configuration
app/caddy/Caddyfile:
# Serve uploaded files
handle_path /upload/* {
root * /upload
file_server
# Disable the 'Expect: 100-continue' header for easier uploads
header Expect nil
# Long-term caching for uploaded files
header Cache-Control "public, max-age=2592000, immutable"
}docker compose cp path/to/files/. sftp:/home/user/upload/