ueihdda commited on
Commit
297de14
·
verified ·
1 Parent(s): 9980840

Upload 2 files

Browse files
Files changed (2) hide show
  1. Dockerfile +27 -0
  2. sshd_config.template +25 -0
Dockerfile ADDED
@@ -0,0 +1,27 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ FROM ubuntu:noble
2
+
3
+ # 删除基础镜像中内置的 "ubuntu" 用户和其家目录,从而释放 UID 1000
4
+ RUN userdel -r ubuntu || true
5
+
6
+ # 现在,新建 lingyicute 用户使用 UID 1000
7
+ RUN useradd -m -u 1000 lingyicute
8
+
9
+ # 设置环境变量和工作目录
10
+ ENV HOME=/home/lingyicute \
11
+ PATH=/home/lingyicute/.local/bin:$PATH
12
+ WORKDIR $HOME/app
13
+
14
+ # 复制当前目录下内容到镜像中的 $HOME/app,并指定所有者为 lingyicute(UID 1000)
15
+ COPY --chown=1000 . $HOME/app
16
+
17
+ # 以 root 身份更新 apt 源并安装软件
18
+ RUN apt-get update && \
19
+ apt-get install -y curl jq openssh-server wget nano tmux
20
+
21
+ # 修改 start.sh 的权限,确保对 lingyicute 用户可执行
22
+ RUN chmod +x start.sh && chown -R lingyicute /home/lingyicute && chmod -R u+rw /home/lingyicute
23
+
24
+ # 最后切换到 lingyicute 用户运行
25
+ USER 1000
26
+
27
+ ENTRYPOINT ["./start.sh"]
sshd_config.template ADDED
@@ -0,0 +1,25 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ Port 2222
2
+ HostKey $PWD/ssh_host_rsa_key
3
+
4
+ # PAM is necessary for password authentication on Debian-based systems
5
+ UsePAM yes
6
+
7
+ # Allow interactive authentication (default value)
8
+ #KbdInteractiveAuthentication yes
9
+
10
+ # Same as above but for older SSH versions (default value)
11
+ #ChallengeResponseAuthentication yes
12
+
13
+ # Allow password authentication (default value)
14
+ #PasswordAuthentication yes
15
+
16
+ # Only allow single user
17
+ AllowUsers $USER
18
+
19
+ # Only allow those keys
20
+ AuthorizedKeysFile $PWD/authorized_keys
21
+
22
+ # Force to start tmux on login
23
+ ForceCommand tmux attach
24
+
25
+ # vim: ft=sshdconfig