You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 

29 lines
1.1 KiB

# Original code from https://github.com/gituser173/docker-scp-server
# This image is designed to collaborate with the Docker Hub image httpd:2.4
FROM debian:stable
ENV DATADIR=/usr/local/apache2/htdocs AUTHORIZED_KEYS_FILE=/authorized_keys USERID=33 GROUPID=33 OWNER=data
RUN apt update \
&& apt install -y openssh-server
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 $DATADIR $OWNER \
&& mkdir -p "$DATADIR" \
&& chown $OWNER "$DATADIR" \
&& echo "AuthorizedKeysFile $AUTHORIZED_KEYS_FILE" >> /etc/ssh/sshd_config \
&& echo "X11Forwarding no" >> /etc/ssh/sshd_config \
&& echo "AllowTcpForwarding no" >> /etc/ssh/sshd_config \
&& echo "ChrootDirectory %h" >> /etc/ssh/sshd_config \
&& echo "ForceCommad internal-sftp" >> /etc/ssh/sshd_config \
&& touch $AUTHORIZED_KEYS_FILE \
&& chown $OWNER $AUTHORIZED_KEYS_FILE \
&& chmod 0600 $AUTHORIZED_KEYS_FILE \
&& mkdir /var/run/sshd && chmod 0755 /var/run/sshd \
&& echo "+:@data:ALL" >> /etc/security/access.conf
ADD entrypoint.sh /
EXPOSE 22
CMD ["/entrypoint.sh"]