Skip to content

Instantly share code, notes, and snippets.

@caliburn1994
Last active October 28, 2020 14:27
Show Gist options
  • Save caliburn1994/ba20ebaca880e42d86dc54655a20b7ba to your computer and use it in GitHub Desktop.
Save caliburn1994/ba20ebaca880e42d86dc54655a20b7ba to your computer and use it in GitHub Desktop.
Docker SSH Server + public key authentication . login as root
mkdir data keys public
# copy public key to current dir, for safe.
cp ${HOME}/.ssh/id_rsa.pub public/
docker run -ti -p 2222:22 \
-v $(pwd)/public/id_rsa.pub:/root/.ssh/authorized_keys \
-v $(pwd)/keys/:/etc/ssh/keys \
-v $(pwd)/data/:/data/ \
-e SSH_ENABLE_ROOT=true \
docker.io/panubo/sshd:1.3.0
ssh root@localhost -p 2222
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment