Skip to content

Instantly share code, notes, and snippets.

@Himura2la
Last active August 25, 2020 17:40
Show Gist options
  • Save Himura2la/46038ff7cf73477a16d910d62d598248 to your computer and use it in GitHub Desktop.
Save Himura2la/46038ff7cf73477a16d910d62d598248 to your computer and use it in GitHub Desktop.
sshd
FROM debian:stable-slim
EXPOSE 22
RUN apt-get update && apt-get install -y openssh-server
RUN mkdir /var/run/sshd &&\
sed -e 's/#PasswordAuthentication yes/PasswordAuthentication no/' \
-e 's/#PermitRootLogin prohibit-password/PermitRootLogin no/' \
-e 's/#ClientAliveInterval 0/ClientAliveInterval 60/' \
-i /etc/ssh/sshd_config
RUN useradd -m -s /bin/bash user
COPY authorized_keys /home/user/.ssh/authorized_keys
RUN cd /home/user/.ssh && chown -vR user:user . && chmod -v 700 . && chmod -v 600 *
CMD ["/usr/sbin/sshd", "-D"]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment