38 lines
877 B
Docker
38 lines
877 B
Docker
|
FROM ubuntu:22.04
|
||
|
|
||
|
RUN apt-get update && \
|
||
|
apt-get install -y sudo ssh less
|
||
|
|
||
|
RUN useradd -m hacker
|
||
|
|
||
|
RUN echo "hacker:hacker0619" | chpasswd
|
||
|
|
||
|
RUN mkdir /var/run/sshd
|
||
|
|
||
|
|
||
|
WORKDIR /home/hacker
|
||
|
|
||
|
|
||
|
RUN mkdir /home/hacker/dev && \
|
||
|
mknod /home/hacker/dev/null c 1 3 && \
|
||
|
mknod /home/hacker/dev/zero c 1 5 && \
|
||
|
mknod /home/hacker/dev/random c 1 8 && \
|
||
|
mknod /home/hacker/dev/urandom c 1 9 && \
|
||
|
chmod 666 /home/hacker/dev/*
|
||
|
|
||
|
RUN mkdir /home/hacker/bin && \
|
||
|
cp /bin/ls /home/hacker/bin && \
|
||
|
cp /bin/cat /home/hacker/bin && \
|
||
|
cp /bin/head /home/hacker/bin && \
|
||
|
cp /bin/more /home/hacker/bin && \
|
||
|
cp /bin/tac /home/hacker/bin
|
||
|
|
||
|
COPY ./bin/ /home/hacker/
|
||
|
RUN chown -R root:hacker /home/hacker && \
|
||
|
chmod -R 750 /home/hacker && \
|
||
|
chmod 700 /home/hacker/flag && \
|
||
|
chmod u+s /home/hacker/bin/tac
|
||
|
|
||
|
CMD ["/usr/sbin/sshd", "-D"]
|
||
|
|
||
|
EXPOSE 22
|