commit c25801daadda09da94bffd7b5422571fcd0f6277 Author: Adrian Dvergsdal Date: Tue Oct 7 21:34:24 2014 +0200 First commit diff --git a/.dockerignore b/.dockerignore new file mode 100644 index 0000000..6b8710a --- /dev/null +++ b/.dockerignore @@ -0,0 +1 @@ +.git diff --git a/Dockerfile b/Dockerfile new file mode 100644 index 0000000..0d7087f --- /dev/null +++ b/Dockerfile @@ -0,0 +1,15 @@ +FROM debian:wheezy +MAINTAINER Adrian Dvergsdal + +RUN apt-get update && DEBIAN_FRONTEND=noninteractive apt-get -y install openssh-server + +RUN mkdir -p /var/run/sshd +RUN addgroup --system sftp + +ADD . /root +WORKDIR /root +RUN mv sshd_config /etc/ssh/sshd_config + +EXPOSE 22 + +CMD ["/bin/bash", "run"] diff --git a/run b/run new file mode 100644 index 0000000..d443a7a --- /dev/null +++ b/run @@ -0,0 +1,18 @@ +#!/bin/bash + +# Add users +IFS=',' read -a users <<< "$SFTP_USERS" +for userData in "${users[@]}"; do + IFS=':' read -a data <<< "$userData" + user="${data[0]}" + pass="${data[1]}" + + useradd -G sftp $user + echo "$user:$pass" | chpasswd + chown root:root /home/$user + chmod 755 /home/$user + chown -R $user:sftp /home/$user/* +done + +# Run SSH +/usr/sbin/sshd -D diff --git a/sshd_config b/sshd_config new file mode 100644 index 0000000..4a21d09 --- /dev/null +++ b/sshd_config @@ -0,0 +1,11 @@ +PermitRootLogin no +#ChallengeResponseAuthentication no +UsePAM no +Subsystem sftp internal-sftp + +Match group sftp + ChrootDirectory %h + X11Forwarding no + AllowTcpForwarding no + ForceCommand internal-sftp +