https://github.com/zas/docker-rsyncssh
https://github.com/zas/docker-rsyncssh
Last synced: 2 months ago
JSON representation
- Host: GitHub
- URL: https://github.com/zas/docker-rsyncssh
- Owner: zas
- Created: 2016-06-20T15:42:34.000Z (almost 9 years ago)
- Default Branch: master
- Last Pushed: 2016-06-20T18:27:15.000Z (almost 9 years ago)
- Last Synced: 2025-01-19T21:43:34.785Z (4 months ago)
- Language: Perl
- Size: 6.84 KB
- Stars: 0
- Watchers: 2
- Forks: 1
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# ssh+rsync Docker image
Once configured to accept one or more ssh keys, it will permit one to use rsync+ssh to store data or to read data to/from the docker container.
The container is exporting:
* port 22 (for ssh connections)
* `/data` volume## Build image
```
docker build --rm -t ssh-rsync-image .
```## Run the container
* First you need to create at least one ssh key (without passphrase)
```
ssh-keygen -t rsa -f ~/.ssh/id_rsa_rsync -N ''
```* Run the container:
```
docker run -itdP -p 22222:22 -v ~/data:/data -e AUTHORIZED_KEYS="rw:`cat ~/.ssh/id_rsa_rsync.pub`" --name ssh-rsync-server ssh-rsync-image
```* Check logs:
```
docker logs ssh-rsync-server
```## Use
* Rsync local `/etc` to remote `/data/etc` (note: all paths are always relative to `/data`)
```
rsync -av -e "ssh -i $HOME/.ssh/id_rsa_rsync -p 22222" /etc [email protected]:/
```## About authorized keys:
* each key has to be prefixed by rw: or ro:, repectively for read+write access or read-only access
* multiple keys can be specified, separated by "," (commas)Exemple: `AUTHORIZED_KEYS="rw:myfirstkey, ro:mysecondkey"`
Inspired by:
* https://github.com/tutumcloud/authorizedkeys
* https://github.com/Thrilleratplay/docker-ssh-rsync
* https://www.guyrutenberg.com/2014/01/14/restricting-ssh-access-to-rsync/