2023-11-28 17:51:46 -05:00
|
|
|
FROM ubuntu:latest
|
|
|
|
|
2023-12-09 06:19:14 -05:00
|
|
|
ENV DEBIAN_FRONTEND=noninteractive
|
2023-11-28 17:51:46 -05:00
|
|
|
|
2023-12-09 06:19:14 -05:00
|
|
|
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/
|
2023-11-28 17:51:46 -05:00
|
|
|
|
2023-12-09 06:19:14 -05:00
|
|
|
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/
|
2023-11-28 17:51:46 -05:00
|
|
|
|
2023-12-09 06:19:14 -05:00
|
|
|
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
|
2023-11-28 17:51:46 -05:00
|
|
|
|
2023-12-09 06:19:14 -05:00
|
|
|
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
|
2023-11-28 17:51:46 -05:00
|
|
|
|
2023-12-09 06:19:14 -05:00
|
|
|
RUN service ssh start
|
|
|
|
|
|
|
|
EXPOSE 22
|
|
|
|
|
|
|
|
CMD ["/usr/sbin/sshd","-D"]
|