working
This commit is contained in:
35
Dockerfile
35
Dockerfile
@ -1,13 +1,36 @@
|
||||
FROM ubuntu:latest
|
||||
|
||||
RUN apt update && apt install openssh-server sudo scp -y
|
||||
ENV DEBIAN_FRONTEND=noninteractive
|
||||
|
||||
RUN useradd -rm -d /home/ubuntu -s /bin/bash -g root -G sudo -u 1000 test
|
||||
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/
|
||||
|
||||
RUN echo 'test:test' | chpasswd
|
||||
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 service ssh start
|
||||
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
|
||||
|
||||
EXPOSE 22
|
||||
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
|
||||
|
||||
CMD ["/usr/sbin/sshd","-D"]
|
||||
RUN service ssh start
|
||||
|
||||
EXPOSE 22
|
||||
|
||||
CMD ["/usr/sbin/sshd","-D"]
|
||||
|
Reference in New Issue
Block a user