FROM ubuntu:latest ENV DEBIAN_FRONTEND=noninteractive # Install packages RUN apt update && \ apt install --no-install-recommends -y \ nano \ openssh-server \ openssh-client \ rsync \ sudo && \ rm -rf /var/lib/apt/lists/* # User setup RUN useradd -m -d /home/user -s /bin/bash -U -u 1000 user && \ mkdir /home/user/.ssh && \ chown -R user:user /home/user/.ssh && \ mkdir /sftp && \ chown root:root /sftp && \ chmod 755 /sftp RUN echo 'user:password' | chpasswd COPY authorized_keys /home/user/.ssh/ COPY sshd_config ssh_host_* /etc/ssh/ RUN chown user:user /home/user/.ssh/authorized_keys && \ chmod 644 /home/user/.ssh/authorized_keys && \ 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 && \ mkdir /run/sshd EXPOSE 22 CMD ["/usr/sbin/sshd","-D","-e"]