diff --git a/Dockerfile b/Dockerfile index 8ce1c17..0b92c13 100644 --- a/Dockerfile +++ b/Dockerfile @@ -3,6 +3,7 @@ MAINTAINER Knut Ahlers ENV USER share ENV PASS changeme +ENV USER_UID 1000 RUN apt-get update && \ apt-get install -y openssh-server mcrypt && \ diff --git a/start.sh b/start.sh index a32a1da..e006bba 100644 --- a/start.sh +++ b/start.sh @@ -1,12 +1,11 @@ #!/bin/bash -ENC_PASS=$(perl -e 'print crypt($ARGV[0], "password")' ${PASS}) - if ( id ${USER} ); then - echo "FATAL: User ${USER} already exists" - exit 1 + echo "INFO: User ${USER} already exists" +else + echo "INFO: User ${USER} does not exists, we create it" + ENC_PASS=$(perl -e 'print crypt($ARGV[0], "password")' ${PASS}) + useradd -d /data -m -p ${ENC_PASS} -u ${USER_UID} -s /bin/sh ${USER} fi -useradd -d /data -m -p ${ENC_PASS} -u 1000 -s /bin/sh ${USER} - exec /usr/sbin/sshd -D