mirror of
https://github.com/luzifer-docker/sftp-share.git
synced 2024-12-20 22:11:16 +00:00
Merge pull request #1 from ambroisemaupate/master
Custom UID and restartable container
This commit is contained in:
commit
f5142c82d6
2 changed files with 6 additions and 6 deletions
|
@ -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 && \
|
||||||
|
|
11
start.sh
11
start.sh
|
@ -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
|
||||||
|
|
Loading…
Reference in a new issue