FROM ubuntu:14.04 MAINTAINER Blake Hitchcock
RUN apt-get update; apt-get install -y openssh-server RUN mkdir -p ~root/.ssh && chmod 700 ~root/.ssh/ && \
echo "Port 22\n" >> /etc/ssh/sshd_config && \ cp -a /etc/ssh /etc/ssh.cache
RUN mkdir /var/run/sshd
# Create Sudo user # useradd doesn't like -m in a script. RUN useradd -K MAIL_DIR=/dev/null -s /bin/bash testuser RUN mkdir -p /home/testuser/.ssh RUN sed -i '4itestuser ALL= (ALL) NOPASSWD: ALL' /etc/sudoers COPY ssh_key.pub /home/testuser/.ssh/authorized_keys RUN chown -R testuser /home/testuser RUN chmod 600 /home/testuser/.ssh/authorized_keys
EXPOSE 22 CMD [“/usr/sbin/sshd”, “-D”]