docker-sshd/entrypoint.sh
2017-04-28 19:52:12 +02:00

13 lines
332 B
Bash
Executable File

#!/bin/sh
# generate host keys if not present
ssh-keygen -A
# check wether a random root-password is provided
if [ ! -z ${ROOT_PASSWORD} ] && [ "${ROOT_PASSWORD}" != "root" ]; then
echo "root:${ROOT_PASSWORD}" | chpasswd
fi
# do not detach (-D), log to stderr (-e), passthrough other arguments
exec /usr/sbin/sshd -D -e "$@"