You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: README.md
+24-50Lines changed: 24 additions & 50 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -1,23 +1,26 @@
1
1
# SFTP
2
2
3
-
**Forked from atmoz to make it easier to setup on kubernetes. also add fail2ban. merges in PRs to fix a number of issues**
3
+
**Forked from atmoz to make it easier to setup on kubernetes. adds fail2ban from [this pr](https://github.com/atmoz/sftp/pull/189). merges in PRs to fix a number of issues**

8
8
9
-
# Supported tags and respective `Dockerfile` links
9
+
##Supported tags and respective `Dockerfile` links
10
10
11
-
-[`debian-stretch`, `debian`, `latest` (*Dockerfile*)](https://github.com/atmoz/sftp/blob/master/Dockerfile)[](http://microbadger.com/images/atmoz/sftp"Get your own image badge on microbadger.com")
12
-
-[`debian-jessie` (*Dockerfile*)](https://github.com/atmoz/sftp/blob/debian-jessie/Dockerfile)[](http://microbadger.com/images/atmoz/sftp:debian-jessie"Get your own image badge on microbadger.com")
13
-
-[`alpine` (*Dockerfile*)](https://github.com/atmoz/sftp/blob/alpine/Dockerfile)[](http://microbadger.com/images/atmoz/sftp:alpine"Get your own image badge on microbadger.com")
11
+
-[`debian`, `latest` (*Dockerfile*)](https://github.com/yakworks/docker-sftp/blob/master/Dockerfile)[](http://microbadger.com/images/yakworks/sftp"Get your own image badge on microbadger.com")
14
12
15
-
# Securely share your files
13
+
##Securely share your files
16
14
17
15
Easy to use SFTP ([SSH File Transfer Protocol](https://en.wikipedia.org/wiki/SSH_File_Transfer_Protocol)) server with [OpenSSH](https://en.wikipedia.org/wiki/OpenSSH).
18
-
This is an automated build linked with the [debian](https://hub.docker.com/_/debian/)and [alpine](https://hub.docker.com/_/alpine/)repositories.
16
+
This is an automated build linked with the [debian](https://hub.docker.com/_/debian/) repositories.
19
17
20
-
# Usage
18
+
19
+
## Example Quickstart
20
+
21
+
to run the example in this project `./examples/docker-run.sh`
or (3) in file mounted as `/etc/sftp/users.conf` (syntax:
@@ -35,51 +38,35 @@ This is an automated build linked with the [debian](https://hub.docker.com/_/deb
35
38
want them to upload files.
36
39
- For consistent server fingerprint, mount your own host keys (i.e. `/etc/ssh/ssh_host_*`)
37
40
38
-
# Examples
39
-
40
-
to run the example in this project `./examples/docker-run.sh`
41
-
42
-
## Simplest docker run example
41
+
### Simplest docker run example
43
42
44
43
```
45
-
docker run -p 22:22 -d atmoz/sftp foo:pass:::upload
44
+
docker run -p 22:22 -d yakworks/sftp foo:pass:::upload
46
45
```
47
46
48
47
User "foo" with password "pass" can login with sftp and upload files to a folder called "upload". No mounted directories or custom UID/GID. Later you can inspect the files and use `--volumes-from` to mount them somewhere else (or see next example).
49
48
50
-
## Sharing a directory from your computer
49
+
###Sharing a directory from your computer
51
50
52
51
Let's mount a directory and set UID:
53
52
54
53
```
55
54
docker run \
56
-
-v /host/upload:/home/foo/upload \
57
-
-p 2222:22 -d atmoz/sftp \
55
+
-v /host/upload:/data \
56
+
-p 2222:22 -d yakworks/sftp \
58
57
foo:pass:1001
59
58
```
60
59
61
-
### Using Docker Compose:
62
-
63
-
```
64
-
sftp:
65
-
image: atmoz/sftp
66
-
volumes:
67
-
- /host/upload:/home/foo/upload
68
-
ports:
69
-
- "2222:22"
70
-
command: foo:pass:1001
71
-
```
72
-
73
60
### Logging in
74
61
75
62
The OpenSSH server runs by default on port 22, and in this example, we are forwarding the container's port 22 to the host's port 2222. To log in with the OpenSSH client, run: `sftp -P 2222 foo@<host-ip>`
76
63
77
-
## Store users in config
64
+
###Store users in config
78
65
79
66
```
80
67
docker run \
81
68
-v /host/users.conf:/etc/sftp/users.conf:ro \
82
-
-v mySftpVolume:/home \
69
+
-v mySftpVolume:/data \
83
70
-p 2222:22 -d atmoz/sftp
84
71
```
85
72
@@ -91,7 +78,7 @@ bar:abc:1002:100
91
78
baz:xyz:1003:100
92
79
```
93
80
94
-
## Encrypted password
81
+
###Encrypted password
95
82
96
83
Add `:e` behind password to mark it as encrypted. Use single quotes if using terminal.
97
84
@@ -105,7 +92,7 @@ docker run \
105
92
Tip: you can use [atmoz/makepasswd](https://hub.docker.com/r/atmoz/makepasswd/) to generate encrypted passwords:
Mount public keys in the user's `.ssh/keys/` directory. All keys are automatically appended to `.ssh/authorized_keys` (you can't mount this file directly, because OpenSSH requires limited file permissions). In this example, we do not provide any password, so the user `foo` can only login with his SSH key.
111
98
@@ -118,7 +105,7 @@ docker run \
118
105
foo::1001
119
106
```
120
107
121
-
## Providing your own SSH host key (recommended)
108
+
###Providing your own SSH host key (recommended)
122
109
123
110
This container will generate new SSH host keys at first run. To avoid that your users get a MITM warning when you recreate your container (and the host keys changes), you can mount your own host keys.
Put your programs in `/etc/sftp.d/` and it will automatically run when the container starts.
144
131
See next section for an example.
145
132
146
-
## Bindmount dirs from another location
133
+
###Bindmount dirs from another location
147
134
148
135
If you are using `--volumes-from` or just want to make a custom directory available in user's home directory, you can add a script to `/etc/sftp.d/` that bindmounts after container starts.
**NOTE:** Using `mount` requires that your container runs with the `CAP_SYS_ADMIN` capability turned on. [See this answer for more information](https://github.com/atmoz/sftp/issues/60#issuecomment-332909232).
172
-
173
-
# What's the difference between Debian and Alpine?
174
-
175
-
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's 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 cycle (about 6 months) and therefore newer versions of OpenSSH. As I'm writing this, Debian has version 7.4 while Alpine has version 7.5. Recommended reading: [Comparing Debian vs Alpine for container & Docker apps](https://www.turnkeylinux.org/blog/alpine-vs-debian)
176
-
177
-
# What version of OpenSSH do I get?
178
-
179
-
It depends on which linux distro and version you choose (see available images at the top). You can see what version you get by checking the distro's packages online. I have provided direct links below for easy access.
180
-
181
-
-[List of `openssh` packages on Alpine releases](https://pkgs.alpinelinux.org/packages?name=openssh&branch=&repo=main&arch=x86_64)
182
-
-[List of `openssh-server` packages on Debian releases](https://packages.debian.org/search?keywords=openssh-server&searchon=names&exact=1&suite=all§ion=main)
183
-
184
-
**Note:** The time when this image was last built can delay the availability of an OpenSSH release. Since this is an automated build linked with [debian](https://hub.docker.com/_/debian/) and [alpine](https://hub.docker.com/_/alpine/) repos, the build will depend on how often they push changes (out of my control). Typically this can take 1-5 days, but it can also take longer. You can of course make this more predictable by cloning this repo and run your own build manually.
0 commit comments