0
0
Fork 0
mirror of https://github.com/atmoz/sftp.git synced 2024-11-24 12:59:24 -05:00

Update README.md

This commit is contained in:
Adrian Dvergsdal 2017-02-15 21:34:22 +01:00
parent f30a9fb9e7
commit 163ace1412

View file

@ -1,8 +1,8 @@
# Supported tags and respective `Dockerfile` links
- [`debian-jessie`, `debian`, `latest` (*Dockerfile*)](https://github.com/atmoz/sftp/blob/master/Dockerfile) [![](https://images.microbadger.com/badges/image/atmoz/sftp.svg)](http://microbadger.com/images/atmoz/sftp "Get your own image badge on microbadger.com")
- [`alpine-3.4` (*Dockerfile*)](https://github.com/atmoz/sftp/blob/alpine-3.4/Dockerfile) [![](https://images.microbadger.com/badges/image/atmoz/sftp:alpine-3.4.svg)](http://microbadger.com/images/atmoz/sftp:alpine-3.4 "Get your own image badge on microbadger.com")
- [`alpine-3.5`, `alpine` (*Dockerfile*)](https://github.com/atmoz/sftp/blob/alpine/Dockerfile) [![](https://images.microbadger.com/badges/image/atmoz/sftp:alpine.svg)](http://microbadger.com/images/atmoz/sftp:alpine "Get your own image badge on microbadger.com")
- [`alpine-3.4` (*Dockerfile*)](https://github.com/atmoz/sftp/blob/alpine-3.4/Dockerfile) [![](https://images.microbadger.com/badges/image/atmoz/sftp:alpine-3.4.svg)](http://microbadger.com/images/atmoz/sftp:alpine-3.4 "Get your own image badge on microbadger.com")
# Securely share your files
@ -11,22 +11,27 @@ This is an automated build linked with the [debian](https://hub.docker.com/_/deb
# Usage
- Define users as command arguments, STDIN or mounted in `/etc/sftp-users.conf`
- Required: define users as command arguments, STDIN or mounted in `/etc/sftp-users.conf`
(syntax: `user:pass[:e][:uid[:gid[:dir1[,dir2]...]]]...`).
- Set UID/GID manually for your users if you want them to make changes to
your mounted volumes with permissions matching your host filesystem.
- Add directory names at the end, if you want to create them and/or set user
ownership. Perfect when you just want a fast way to upload something without
mounting any directories, or you want to make sure a directory is owned by
a user (chown -R).
- Mount volumes in user's home directory.
- The users are chrooted to their home directory, so you must mount the
- Add directory names at the end, if you want to create them under the user's
home directory. Perfect when you just want a fast way to upload something.
- Optional (but recommended): mount volumes.
- The users are chrooted to their home directory, so you can mount the
volumes in separate directories inside the user's home directory
(/home/user/**mounted-directory**).
(/home/user/**mounted-directory**) or just mount the whole /home directory.
Just remember that the users can't create new files directly under their
own home directory, so make sure there are at least one subdirectory if you
want them to upload files.
- For consistent server fingerprint, mount your own host keys (i.e. `/etc/ssh/ssh_host_*`)
# What's the difference between Debian and Alpine?
The biggest differences are in size and OpenSSH version. [Alpine](https://hub.docker.com/_/alpine/) is 10 times smaller than [Debian](https://hub.docker.com/_/debian/). OpenSSH version can also differ, as it is two different teams maintaining the packages. Debian is generally considered more stable and only bugfixes and security fixes are added after each Debian release (about 2 years). Alpine has a faster release cyle (about 6 months) and therefore newer versions of OpenSSH. As I'm writing this, Debian has version 6.7 while Alpine has version 7.4. Recommended reading: [Comparing Debian vs Alpine for container & Docker apps](https://www.turnkeylinux.org/blog/alpine-vs-debian)
# Examples
## Simplest docker run example
```
@ -41,9 +46,11 @@ Let's mount a directory and set UID:
```
docker run \
-v /host/share:/home/foo/share \
-v /host/upload:/home/foo/upload \
-v /host/ssh_host_ed25519_key:/etc/ssh/ssh_host_ed25519_key \
-v /host/ssh_host_rsa_key:/etc/ssh/ssh_host_rsa_key \
-p 2222:22 -d atmoz/sftp \
foo:123:1001
foo:pass:1001
```
### Using Docker Compose:
@ -52,10 +59,12 @@ docker run \
sftp:
image: atmoz/sftp
volumes:
- /host/share:/home/foo/share
- /host/upload:/home/foo/upload
- /host/ssh_host_ed25519_key:/etc/ssh/ssh_host_ed25519_key
- /host/ssh_host_rsa_key:/etc/ssh/ssh_host_rsa_key
ports:
- "2222:22"
command: foo:123:1001
command: foo:pass:1001
```
### Logging in
@ -69,17 +78,18 @@ OpenSSH client, run: `sftp -P 2222 foo@<host-ip>`
```
docker run \
-v /host/users.conf:/etc/sftp-users.conf:ro \
-v /host/share:/home/foo/share \
-v /host/documents:/home/foo/documents \
-v /host/http:/home/bar/http \
-v mySftpVolume:/home \
-v /host/ssh_host_ed25519_key:/etc/ssh/ssh_host_ed25519_key \
-v /host/ssh_host_rsa_key:/etc/ssh/ssh_host_rsa_key \
-p 2222:22 -d atmoz/sftp
```
/host/users.conf:
```
foo:123:1001
bar:abc:1002
foo:123:1001:100
bar:abc:1002:100
baz:xyz:1003:100
```
## Encrypted password