From ecacba1c0e7de88caa5f1a96261b3c2086caa8ee Mon Sep 17 00:00:00 2001 From: Christoffer Martinsson Date: Sat, 13 Apr 2024 09:19:10 +0200 Subject: [PATCH] Add new file --- Dockerfile | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) create mode 100644 Dockerfile diff --git a/Dockerfile b/Dockerfile new file mode 100644 index 0000000..2eae060 --- /dev/null +++ b/Dockerfile @@ -0,0 +1,22 @@ +FROM ubuntu:22.04 + +# Update the system, install OpenSSH Server, and set up users +RUN apt-get update && apt-get upgrade -y && \ + apt-get install -y openssh-server + +# Create user and set password for user and root user +RUN useradd -rm -d /home/code -s /bin/bash -g root -G sudo -u 1000 code && \ + echo 'code:changethis' | chpasswd && \ + echo 'root:changethis' | chpasswd + +# Set up configuration for SSH +RUN mkdir /var/run/sshd && \ + sed -i 's/PermitRootLogin prohibit-password/PermitRootLogin yes/' /etc/ssh/sshd_config && \ + sed 's@session\s*required\s*pam_loginuid.so@session optional pam_loginuid.so@g' -i /etc/pam.d/sshd && \ + echo "export VISIBLE=now" >> /etc/profile + +# Expose the SSH port +EXPOSE 22 + +# Run SSH +CMD ["/usr/sbin/sshd", "-D"] \ No newline at end of file