| 1 |
FROM debian:trixie-slim |
| 2 |
|
| 3 |
LABEL org.opencontainers.image.authors="[email protected]" |
| 4 |
|
| 5 |
ENV DEBIAN_FRONTEND=noninteractive |
| 6 |
|
| 7 |
RUN apt update -q=2 && \ |
| 8 |
apt install -q=2 --yes --no-install-recommends openssh-server && \ |
| 9 |
rm -rf /var/lib/apt/lists/* && \ |
| 10 |
echo 'root:PASSWORD' | chpasswd && \ |
| 11 |
echo 'PermitRootLogin yes' >> /etc/ssh/sshd_config && \ |
| 12 |
sed 's@session\s*required\s*pam_loginuid.so@session optional pam_loginuid.so@g' -i /etc/pam.d/sshd |
| 13 |
# SSH login fix. Otherwise user is kicked off after login |
| 14 |
|
| 15 |
COPY --chown=root:root ./authorized_keys /root/.ssh/authorized_keys |
| 16 |
|
| 17 |
# As sshd scrubs ENV variables if they are set by the ENV varibale ensure to put the into /etc/profile as shown below |
| 18 |
ENV NOTVISIBLE="in users profile" |
| 19 |
RUN echo "export VISIBLE=now" >> /etc/profile |
| 20 |
|
| 21 |
EXPOSE 2222 |
| 22 |
CMD ["/usr/sbin/sshd", "-D", "-p", "2222"] |