Browse Source

Some more fixups for the previous commit

master
Carlos Mogas da Silva 2 months ago
parent
commit
203c839df0
  1. 4
      Dockerfile
  2. 6
      entrypoint.sh

4
Dockerfile

@ -8,7 +8,7 @@ RUN apt update \
RUN rm -f /etc/ssh/ssh_host_* \
&& groupadd --non-unique --gid $GROUPID data \
&& useradd --non-unique --uid $USERID --gid $GROUPID --no-create-home --home-dir /home/data $OWNER \
&& useradd --non-unique --uid $USERID --gid $GROUPID --no-create-home --home-dir /home/data data \
&& mkdir -p /home/data \
&& mkdir -p /etc/ssh/host_keys/ \
&& echo "AuthorizedKeysFile $AUTHORIZED_KEYS_FILE" >> /etc/ssh/sshd_config \
@ -19,7 +19,7 @@ RUN rm -f /etc/ssh/ssh_host_* \
&& echo "ChrootDirectory %h" >> /etc/ssh/sshd_config \
&& echo "ForceCommand internal-sftp" >> /etc/ssh/sshd_config \
&& touch $AUTHORIZED_KEYS_FILE \
&& chown $OWNER $AUTHORIZED_KEYS_FILE \
&& chown data:data $AUTHORIZED_KEYS_FILE \
&& chmod 0600 $AUTHORIZED_KEYS_FILE \
&& mkdir /var/run/sshd && chmod 0755 /var/run/sshd \
&& echo "+:@data:ALL" >> /etc/security/access.conf

6
entrypoint.sh

@ -9,10 +9,10 @@
echo "$AUTHORIZED_KEYS" > $AUTHORIZED_KEYS_FILE
groupmod --non-unique --gid "$GROUPID" data
usermod --non-unique --uid "$USERID" --gid "$GROUPID" "$OWNER"
usermod --non-unique --uid "$USERID" --gid "$GROUPID" data
# Chown data folder (if mounted as a volume for the first time)
chown -R "${OWNER}:data" "/home/data/*"
chown "${OWNER}:data" $AUTHORIZED_KEYS_FILE
chown -R "${USERID}:${GROUPID}" "/home/data/*"
chown "${USERID}:${GROUPID}" $AUTHORIZED_KEYS_FILE
# Run sshd on container start
exec /usr/sbin/sshd -D -e
Loading…
Cancel
Save