HUB
Sign inSign up

danisla/ssh-server

By danisla

•Updated over 10 years ago

Simple nologin ssh server used for port forwarding.

Image
0

405

danisla/ssh-server repository overview

⁠Tags and Dockerfiles

⁠ssh-server for Docker

SSH Server that can be used for port forwarding or serving files. This can be useful when doing development or testing with --net=host and the docker host is not accessible to your local machine.

⁠Example:

# generate ssh key.
ssh-keygen -t rsa -f id_rsa.key -N ''

# start container
docker run --name ssh -d --net host -v "id_rsa.key.pub":/etc/ssh/keys/id_rsa.key.pub:ro danisla/ssh-server:latest

# SSH and forward ports.
ssh -f -N -i ./id_rsa.key -L 8080:localhost:8080 nobody@<docker host ip>

The entrypoint start.sh script sets up the user and group, chowns the data dir and starts sshd.

The sshd_config is setup to read the authorized_keys file dynamically using the provided /usr/local/bin/get_keys.sh script so public keys just need to be mounted into the container at runtime.

⁠Environment variables

⁠SSH_UID

UID of ssh user, default is 1000

⁠SSH_GID

GID of ssh user, default is 1000

⁠SSH_USER

User name of ssh user, default is nobody

⁠DATA_DIR

Home directory of ssh user, default is /tmp

⁠KEYS_DIR

Directory in container where authorized public key files (*.pub) live.

Tag summary

Content type

Image

Digest

Size

86.9 MB

Last updated

over 10 years ago

docker pull danisla/ssh-server