Custom UID and made container restartable

This commit is contained in:
Ambroise Maupate 2015-06-02 20:55:37 +02:00
parent 5767071943
commit fd81a785db
2 changed files with 6 additions and 6 deletions

View file

@ -3,6 +3,7 @@ MAINTAINER Knut Ahlers <knut@ahlers.me>
ENV USER share ENV USER share
ENV PASS changeme ENV PASS changeme
ENV USER_UID 1000
RUN apt-get update && \ RUN apt-get update && \
apt-get install -y openssh-server mcrypt && \ apt-get install -y openssh-server mcrypt && \

View file

@ -1,12 +1,11 @@
#!/bin/bash #!/bin/bash
ENC_PASS=$(perl -e 'print crypt($ARGV[0], "password")' ${PASS})
if ( id ${USER} ); then if ( id ${USER} ); then
echo "FATAL: User ${USER} already exists" echo "INFO: User ${USER} already exists"
exit 1 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 fi
useradd -d /data -m -p ${ENC_PASS} -u 1000 -s /bin/sh ${USER}
exec /usr/sbin/sshd -D exec /usr/sbin/sshd -D