SSH server with public key authentication enabled
1.2K
Dockerfile for SSH server with public key authentication enabled
Pull the image from Docker Hub
$ docker pull dceoy/sshd
Check out the repository.
$ git clone https://github.com/dceoy/docker-sshd.git
$ cd docker-sshd
Create public/private RSA key pair.
$ docker-compose run --rm --entrypoint=/usr/bin/ssh-keygen --volume=${PWD}/keys:/root/.ssh sshd -t rsa
If you use an already-existing pair, copy the public key file into keys/ instead of the above step.
Create a symlink to the public key file with SSH username root.
$ ln -s id_rsa.pub keys/root
Run an SSH server
$ docker-compose up
Connect to the SSH server with the private key
$ ssh -i keys/id_rsa -p 2222 [email protected]
Content type
Image
Digest
Size
39.7 MB
Last updated
over 5 years ago
docker pull dceoy/sshd