Skip to content

Instantly share code, notes, and snippets.

Created Jul 14, 2022
What would you like to do?
FROM ubuntu:18.04
apt-get update && \
apt-get -y upgrade && \
apt-get install -y build-essential && \
apt-get install -y software-properties-common && \
apt-get install -y curl git man unzip vim wget sudo zsh locales && \
apt-get install -y net-tools iputils-ping emacs
RUN locale-gen en_US.UTF-8
RUN useradd -m testuser
RUN gpasswd -a testuser sudo
RUN echo 'testuser:UnVhUeEK' | chpasswd
RUN sudo sed -i 's/testuser:x:1000:1000::\/home\/testuser:\/bin\/sh/testuser:x:1000:1000::\/home\/testuser:\/bin\/zsh/g' /etc/passwd
RUN apt install -y openssh-server
RUN mkdir /var/run/sshd
RUN sed -i 's/PermitRootLogin prohibit-password/PermitRootLogin yes/' /etc/ssh/sshd_config
# SSH login fix. Otherwise user is kicked off after login
RUN sed 's@session\s*required\s* optional' -i /etc/pam.d/sshd
ENV NOTVISIBLE "in users profile"
RUN echo "export VISIBLE=now" >> /etc/profile
EXPOSE 10022
CMD ["/usr/sbin/sshd", "-D", "-p 10022"]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment