Sign inSign up

saygonka/sftpclient

By saygonka

โ€ขUpdated over 1 year ago

Image
0

338

saygonka/sftpclient repository overview

โ ๐Ÿ“ฆ SFTP Client โ€“ Automated SFTP Backup & Sync Tool

This lightweight Docker container allows you to automatically download or upload files and directories over SFTP from multiple remote servers using a configurable schedule or immediate execution.

Built with Alpine Linux + LFTP, it supports both password and SSH key authentication and organizes transfers into host-specific folders. Perfect for automated backup or synchronization.


โ โœ… Features
  • ๐Ÿ” Download or upload files and directories from multiple SFTP servers
  • ๐Ÿ•“ Scheduled backups via cron or immediate mode
  • ๐Ÿ” Supports password or SSH private key authentication
  • ๐Ÿ“ Organizes downloads per host and mode (download, upload)
  • ๐Ÿงน Automatically cleans up old files based on retention policy
  • ๐Ÿ” Includes verbose logging and optional transfer logs
  • โš™๏ธ Configurable via environment variables and config file

โ ๐Ÿš€ Quick Start
docker run --rm \
  -e TIMEZONE=Europe/Berlin \
  -e LOG_LEVEL=INFO \
  -e RETENTION_DAYS=7 \
  -v $(pwd)/config:/config \
  -v $(pwd)/data:/data \
  -v $(pwd)/logs:/logs \
  saygonka/sftpclient

To schedule the backup (e.g., every day at 3 AM):

docker run --rm \
  -e TIMEZONE=Europe/Berlin \
  -e BACKUP_SCHEDULE="0 3 * * *" \
  -e LOG_LEVEL=INFO \
  -e RETENTION_DAYS=7 \
  -v $(pwd)/config:/config \
  -v $(pwd)/data:/data \
  -v $(pwd)/logs:/logs \
  saygonka/sftpclient

โ ๐Ÿ› ๏ธ Configuration

Create a servers.txt file in the mounted /config directory with the following format:

host,port,user,password,remote_dir,local_dir,is_directory,use_ssh,key_content,mode

Example:

test.rebex.net,22,demo,password,/readme.txt,/data,false,false,,download
example.com,22,user,,/remote-dir,/data,true,true,<SSH_KEY_CONTENT>,upload

โ ๐Ÿ“ Directory Structure

For each host and mode, files will be placed under:

/data/{hostname}/{download|upload}

Tag summary

Content type

Image

Digest

sha256:0357cd663โ€ฆ

Size

9 MB

Last updated

over 1 year ago

docker pull saygonka/sftpclient