feat: 添加SSH测试靶场

This commit is contained in:
ZacharyZcR 2024-12-20 19:08:49 +08:00
parent 672dfee2ac
commit bf1b45f407
2 changed files with 22 additions and 0 deletions

20
TestDocker/SSH/Dockerfile Normal file
View File

@ -0,0 +1,20 @@
# 使用Ubuntu最新版本作为基础镜像
FROM ubuntu:latest
# 安装必要的软件包
RUN apt-get update && apt-get install -y \
openssh-server \
&& rm -rf /var/lib/apt/lists/*
# 创建SSH所需的目录
RUN mkdir /var/run/sshd
# 允许root用户SSH登录并设置密码
RUN sed -i 's/#PermitRootLogin prohibit-password/PermitRootLogin yes/' /etc/ssh/sshd_config
RUN echo 'root:123456' | chpasswd
# 开放22端口
EXPOSE 22
# 启动SSH服务
CMD ["/usr/sbin/sshd", "-D"]

View File

@ -0,0 +1,2 @@
docker build -t ubuntu-ssh .
docker run -d -p 22:22 ubuntu-ssh