FROM ubuntu:latest ENV DEBIAN_FRONTEND=noninteractive RUN apt update && \ apt install --no-install-recommends -y \ nano \ openssh-server \ openssh-client \ rsync \ sudo && \ rm -rf /var/lib/apt/lists/* && \ useradd -m -d /home/user -s /bin/bash -U -G sudo -u 1000 user && \ echo 'user ALL=(ALL) NOPASSWD:ALL' >> /etc/sudoers && \ mkdir /home/user/.ssh/ COPY authorized_keys config id_ed25519 id_ed25519.pub known_hosts /home/user/.ssh/ COPY sshd_config ssh_host_ed25519_key ssh_host_ed25519_key.pub /etc/ssh/ RUN chown -R user:user /home/user/.ssh && \ chmod 644 /home/user/.ssh/authorized_keys && \ chmod 600 /home/user/.ssh/config && \ chmod 600 /home/user/.ssh/id_ed25519 && \ chmod 600 /home/user/.ssh/id_ed25519.pub && \ chmod 600 /home/user/.ssh/known_hosts RUN chown root:root /etc/ssh/* && \ chmod 644 /etc/ssh/sshd_config && \ chmod 600 /etc/ssh/ssh_host_ed25519_key && \ chmod 644 /etc/ssh/ssh_host_ed25519_key.pub RUN service ssh start EXPOSE 22 CMD ["/usr/sbin/sshd","-D"]