Sign inSign up

gerald77/rsync-server-docker

By gerald77

•Updated 7 days ago

Image
0

904

gerald77/rsync-server-docker repository overview

⁠rsync-server-docker

A small rsyncd + sshd server in Docker, based on Debian 13 (trixie-slim). You know, for moving files.

Both protocols run in the same container, so you can use either the native rsync daemon (port 873) or rsync over SSH (port 22).

Fork of axiom-data-science/rsync-server⁠, rebuilt regularly with current security patches.

⁠Quick start

docker run -d \
    --name rsync-server \
    -p 873:873 \
    -p 9000:22 \
    -e USERNAME=user \
    -e PASSWORD=someSecurePassword_NOT_THIS \
    -v /your/folder:/data \
    gerald77/rsync-server-docker:latest

A password is required via PASSWORD or PASSWORD_FILE, even if you only use key authentication. The container exits with an error otherwise.

⁠Environment variables

VariableDescription
USERNAMErsync user for the daemon. Default: user
PASSWORDrsync password (also set as root password for SSH). One of PASSWORD / PASSWORD_FILE is required.
PASSWORD_FILEPath to a file containing the password
AUTHORIZED_KEYSPublic SSH key(s) for the root user. Default: empty
VOLUMEPath served by the rsync daemon inside the container. Default: /data
PUIDUser ID (or name) used for file transfers by the daemon. Default: root
GUIDGroup ID (or name) used for file transfers by the daemon. Default: root
ALLOWSpace-separated list of allowed client networks. Default: 10.0.0.0/8 192.168.0.0/16 172.16.0.0/12 127.0.0.1/32
DENYSpace-separated list of denied sources. Default: *
ROMake the rsync volume read-only (true/false). Default: false
CUSTOMCONFIGExtra line(s) for the [volume] section of rsyncd.conf (\n\t for a new line), e.g. uid = root\n\tgid = root

⁠Using the rsync daemon (port 873)

The module is always called volume, no matter what VOLUME points to.

rsync -av /your/folder/ rsync://user@localhost:873/volume

List the module:

rsync rsync://user@localhost:873

⁠Using SSH (port 22)

Connect as root (not as USERNAME). Provide a key via bind mount or AUTHORIZED_KEYS; without one, SSH asks for PASSWORD.

docker run -d \
    --name rsync-server \
    -p 9000:22 \
    -e PASSWORD=someSecurePassword_NOT_THIS \
    -v /your/folder:/data \
    -v /my/authorized_keys:/root/.ssh/authorized_keys \
    gerald77/rsync-server-docker:latest
rsync -av -e "ssh -i /your/private.key -p 9000" /your/folder/ root@localhost:/data

With SSH you give the real destination path (e.g. /data), not the module name.

⁠More examples

Password from a file:

docker run -d -p 873:873 \
    -v /your/folder:/data \
    -v ./password-file:/etc/rsyncd/password:ro \
    -e USERNAME=admin \
    -e PASSWORD_FILE=/etc/rsyncd/password \
    gerald77/rsync-server-docker:latest

Custom volume path and allowed clients:

docker run -d -p 873:873 \
    -v /your/folder:/myvolume \
    -e PASSWORD=changeme \
    -e VOLUME=/myvolume \
    -e ALLOW=192.168.24.0/24 \
    gerald77/rsync-server-docker:latest

Read-only share:

docker run -d -p 873:873 -v /your/folder:/data -e PASSWORD=changeme -e RO=true \
    gerald77/rsync-server-docker:latest

⁠Docker Compose

services:
  rsync:
    image: gerald77/rsync-server-docker:latest
    container_name: rsync-server
    restart: unless-stopped
    ports:
      - "873:873"
      - "9000:22"
    environment:
      USERNAME: user
      PASSWORD_FILE: /run/secrets/rsync_password
      ALLOW: "192.168.0.0/16"
    volumes:
      - /your/folder:/data
      - ./authorized_keys:/root/.ssh/authorized_keys
    secrets:
      - rsync_password

secrets:
  rsync_password:
    file: ./rsync_password.txt

⁠Notes

  • Only expose ports 873/22 to networks you trust. SSH root login with password is enabled, so use a strong password or key-only access and restrict clients with ALLOW.
  • authorized_keys must be owned by root; the container fixes ownership and permissions (400) on start.
  • The image is rebuilt automatically on every push to the source repository.

⁠License

This image is a fork of axiom-data-science/rsync-server⁠, which does not publish an explicit license file. No additional license is granted by this fork beyond what the original authors permit; all rights to the original work remain with its authors. The image also contains third-party software (Debian, OpenSSH, rsync), each under its own license; see the license files inside the container (/usr/share/doc/*/copyright) and the Debian licensing information⁠.

If you are the original author and would like something changed or removed, please open an issue at https://github.com/geraldpublic/rsync-server⁠.

⁠Disclaimer

THIS IMAGE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR MAINTAINERS BE LIABLE FOR ANY CLAIM, DAMAGES, DATA LOSS OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE IMAGE OR ITS USE.

Use at your own risk. You are responsible for securing your deployment (strong passwords or keys, network restrictions, regular updates) and for backing up your data. rsync can overwrite and delete files; test with --dry-run first.

⁠Credits

Original project by Kyle Wilcox / Axiom Data Science: https://github.com/axiom-data-science/rsync-server⁠

Tag summary

Content type

Image

Digest

sha256:80ed78068…

Size

39.1 MB

Last updated

7 days ago

docker pull gerald77/rsync-server-docker