An Ubuntu/deb based container with OpenSSH daemon to quickly experiment with sshd_config (aka sshd.conf) in a relatively safe Docker environment. WARNING: The container is not hardened and clear text passwords are in the Dockerfile do not expose it to public networks.
TODO: Expand make functionality by specifying what you want to have
Change the config via Dockerfile, re-build, and run. You can practice Docker skills, sed, and sshd_config.
Using GNU make You will need make to do the following
make help This help.
make build Build the container
make run Run container on port configured in `config.env`
make up Build and Run container with `config.env` (Alias)
make stop Stop and remove a running container
Example To utilize public key ssh auth generate the key
ssh-keygen -f ./my_ssh_key
Uncoment the following in the Dockerfile
COPY my_ssh_key.pub /home/sshuser/.ssh/authorized_keys
RUN chown -R sshuser:sshuser /home/sshuser/.ssh
RUN chmod 600 /home/sshuser/.ssh/authorized_keys
Build Every time something is changed in the Dockerfile you need to rebuild the container.
docker build -t sshd-ubnt .
Run
docker run -d -p2222:22 --name sshd-demo sshd-ubnt
If Docker complains that the container with the same name already exists
docker container rm sshd-demo
SSH to the Container with the password
ssh root@localhost -p 2222
SSH to the Container with the key
ssh -i ./my_ssh_key sshuser@localhost -p 2222