enable keypair auth and some refactoring
This commit is contained in:
14
README.md
14
README.md
@@ -8,6 +8,7 @@ Use this Dockerfile / -image to start a sshd-server upon a lightweight Alpine co
|
||||
* Password of "root"-user can be changed when starting the container using --env
|
||||
|
||||
### Basic Usage
|
||||
#### Authentication by password
|
||||
```
|
||||
$ docker run --rm \
|
||||
--publish=1337:22 \
|
||||
@@ -19,7 +20,18 @@ After the container is up you are able to ssh in it as root with the in --env pr
|
||||
```
|
||||
$ ssh root@mydomain.tld -p 1337
|
||||
```
|
||||
|
||||
#### Authentication by ssh-keypair
|
||||
```
|
||||
$ docker run --rm \
|
||||
--publish=1337:22 \
|
||||
--env KEYPAIR_LOGIN=true \
|
||||
--volume /path/to/authorized_keys:/root/.ssh/authorized_keys \
|
||||
hermsi/alpine-sshd
|
||||
```
|
||||
After the container is up you are able to ssh in it as root by a keypair which matches the provided public-key in authorized_keys for "root"-user.
|
||||
```
|
||||
$ ssh root@mydomain.tld -p 1337 -i /path/to/private_key
|
||||
```
|
||||
### Use with docker-compose
|
||||
I built this image in order to use it along with a nginx and fpm-php container for transferring files via sftp.
|
||||
If you are interested in a Dockerfile which fulfills this need: [this way](https://github.com/Hermsi1337/docker-compose/blob/master/full_php_dev_stack/docker-compose.yml)
|
||||
Reference in New Issue
Block a user