-
Notifications
You must be signed in to change notification settings - Fork 35
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
0 parents
commit a4d1381
Showing
2 changed files
with
46 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
FROM alpine:edge | ||
MAINTAINER Daniel Guerra <[email protected]> | ||
|
||
RUN apk add --update openssh | ||
|
||
RUN ssh-keygen -f /etc/ssh/ssh_host_rsa_key -N '' -t rsa | ||
|
||
RUN sed -i "s/UsePrivilegeSeparation.*/UsePrivilegeSeparation no/g" /etc/ssh/sshd_config && sed -i "s/UsePAM.*/UsePAM no/g" /etc/ssh/sshd_config && sed -i "s/PermitRootLogin.*/PermitRootLogin yes/g" /etc/ssh/sshd_config && sed -i "s/#AuthorizedKeysFile/AuthorizedKeysFile/g" /etc/ssh/sshd_config | ||
|
||
CMD ["/usr/sbin/sshd","-D"] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
Alipne ssh server | ||
|
||
### Dependencies | ||
|
||
* [![2.0.0](https://badge.imagelayers.io/alpine.svg)](https://imagelayers.io/?images=alpine:edge 'edge') alpine:edge | ||
|
||
### Image size | ||
|
||
[![Latest](https://badge.imagelayers.io/danielguerra/apline-sshd.svg)](https://imagelayers.io/?images=danielguerra/alpine-sshd:latest 'latest') danielguerra/alpine-sshd | ||
|
||
### Instructions | ||
|
||
create a ssh volume | ||
```bash | ||
$ docker create -v /root/.ssh --name ssh-container danielguerra/ssh-container /bin/true | ||
``` | ||
create your own keys | ||
```bash | ||
$ docker run --volumes-from ssh-container alpine:edge ssh-keygen -q | ||
``` | ||
add your pub key to authorized_keys file | ||
```bash | ||
$ docker run --volumes-from ssh-container alpine:edge cp /root/.ssh/id_rsa.pub /root/.ssh/authorized_keys | ||
``` | ||
create a copy in your directory (pwd) | ||
```bash | ||
$ docker run --volumes-from ssh-container -v $(pwd):/backup alpine:edge cp -R /root/.ssh/* /backup | ||
``` | ||
start ssh server | ||
```bash | ||
docker run -d -p 9022:22 --volumes-from ssh-container --name=alpine-sshd --hostname=alpine-sshd danielguerra/alpine-sshd | ||
``` | ||
ssh to your server | ||
```bash | ||
ssh -i id_rsa -p 9022 root@<dockerhost> | ||
``` |