Skip to content

Instantly share code, notes, and snippets.

@croepha
Created February 5, 2021 22:54
Show Gist options
  • Save croepha/63551a79d7f4adb76f921c77df14467b to your computer and use it in GitHub Desktop.
Save croepha/63551a79d7f4adb76f921c77df14467b to your computer and use it in GitHub Desktop.
sometimes you just want a bare ubuntu in a container to ssh to
v/entrypoint.bash
#!/bin/bash
#!/bin/bash
# sudo docker run "--env=SSH_KEY=$( ssh-add -L )" --name ssh1 --volume=$HOME/ssh1:/v '--entrypoint=/v/entrypoint.bash' -d ubuntu:20.04
mount -t devtmpfs none /dev
mount -t devpts none /dev/pts
apt update
apt install -y openssh-server
(cd; umask 077 ; mkdir -p .ssh && echo "$SSH_KEY" >> .ssh/authorized_keys; )
mkdir -p /run/sshd
/usr/sbin/sshd
echo "ASDF"
sleep 99999999999
bash
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment