Dockerized sshd daemon
This image will run a container listening on port 22 with OpenSSH daemon. Users inside /data/shadow file will be added to the system with this settings:
sudo hence they can become rootroot user in /data/shadow fileNAME="sshd"
BASE_DIR="/srv/data/docker/containers/${NAME}"
OPTIONS=""
PORT="2022"
[ -d "${BASE_DIR}/conf" ] && OPTIONS="$OPTIONS -v $BASE_DIR/conf:/etc/ssh"
[ -f "${BASE_DIR}/shadowdir/shadow" ] && OPTIONS="$OPTIONS -v $BASE_DIR/shadowdir:/data"
[ -d "${BASE_DIR}/home" ] && OPTIONS="$OPTIONS -v $BASE_DIR/home:/home"
[ -d "${BASE_DIR}/root" ] && OPTIONS="$OPTIONS -v $BASE_DIR/root:/root"
docker run -d -p $PORT:22 --name ${NAME} --hostname ${NAME} --restart=always $OPTIONS neomediatech/sshd
If you want to keep logs then add commands below before docker run:
mkdir -p ${BASE_DIR}/logs && chmod 777 ${BASE_DIR}/logs && touch ${BASE_DIR}/logs/auth.log && \
chmod 666 ${BASE_DIR}/logs/auth.log
OPTIONS="$OPTIONS -v $BASE_DIR/logs:/var/log"
$BASE_DIR/conf and $BASE_DIR/shadowdir/shadow should exists in order to customi[s|z]e your sshd server
mkdir -p ~/custom_sshdocker run --rm -it -v ~/custom_ssh:/data neomediatech/sshd bashcp -ar /etc/ssh /data/exitIf you want to use some user inside this container (otherwise it's useless) you can bind mount a shadow file in /data/shadow container. This must contains only users you want to allow connect to this container. Keep in mind that every user will have permission to become root user through sudo command.
Content type
Image
Digest
sha256:55026a885…
Size
100.2 MB
Last updated
3 months ago
docker pull neomediatech/sshd