ikskuh/rsync-dropbox

By ikskuh

Updated about 1 year ago

A tiny docker container that allows exposing directory access pretty safely via SSH*Rsync

Image

21

rsync Drop Box

A small container that allows exposing directories via SSH+rsync.

Usage:

docker run \
    -p 22:22/tcp \
    -v "$(pwd)/test/data:/data:rw" \
    -v "$(pwd)/test/config:/config:ro" \
    ikskuh/sshfs
Volumes
Volume Mount PointAccessContent
/configread-onlyMust contain the authorized_keys files.
/dataread-writeThis directory is meant to be accessed via SSH.
Ports
PortProtocolFunction
22TCPExposes the SSH port.

authorized_keys

This file is the authorized keys file for the OpenSSH daemon. The file structure should be configured like this:

command="/usr/bin/rrsync -munge -wo /data/folder_a" ssh-rsa ${sshkey_a}
command="/usr/bin/rrsync -munge -ro /data/folder_b" ssh-rsa ${sshkey_b}

Using rrsync -wo restricts rsync to only write to the provided folder, while rrsync -ro allows only fetching data from the folder.

See more in the rrsync documentation.

Testing

Using the script test.sh, you have to create three directories:

[user@host] rsync-dropbox $ mkdir -p test/config test/data
[user@host] rsync-dropbox $ touch test/config/authorized_keys

Then add your key + prefix to the authorized_keys file and start the container:

[user@host] rsync-dropbox $ docker build -t ikskuh/rsync-dropbox .
[user@host] rsync-dropbox $ docker run \
    --rm \
    -p 127.0.0.1:222:22/tcp \
    -v "$(pwd)/test/data:/data:rw" \
    -v "$(pwd)/test/config:/config:ro" \
    ikskuh/rsync-dropbox

Docker Pull Command

docker pull ikskuh/rsync-dropbox