tao-shen Claude Opus 4.6 commited on
Commit
9c608e0
Β·
1 Parent(s): 0c15a92

fix: create /run/sshd, fix websockets API deprecation, root password

Browse files

- mkdir -p /run/sshd in Dockerfile and start-server.sh (sshd needs it)
- Use websockets.asyncio.server.serve with fallback for compatibility
- Set root password for SSH login as root

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>

Dockerfile CHANGED
@@ -32,12 +32,14 @@ RUN curl -fsSL https://claude.ai/install.sh | bash \
32
  # Snapshot base package list (to detect user-added packages later)
33
  RUN dpkg-query -W -f='${Package}\n' | sort > /etc/base-packages.list
34
 
35
- # SSH host keys (system-wide, for root sshd)
36
- RUN ssh-keygen -A
37
 
38
  # User account (for SSH login); container runs as root for system persistence
39
  RUN useradd -m -u 1000 -s /bin/bash -p "$(openssl passwd -6 huggingrun)" user 2>/dev/null || true
40
- RUN mkdir -p /data && chown 1000:1000 /data
 
 
41
 
42
  # nginx + bridge + startup scripts
43
  COPY ubuntu-server/nginx.conf /etc/nginx/nginx.conf
 
32
  # Snapshot base package list (to detect user-added packages later)
33
  RUN dpkg-query -W -f='${Package}\n' | sort > /etc/base-packages.list
34
 
35
+ # SSH: host keys + privilege separation directory
36
+ RUN ssh-keygen -A && mkdir -p /run/sshd
37
 
38
  # User account (for SSH login); container runs as root for system persistence
39
  RUN useradd -m -u 1000 -s /bin/bash -p "$(openssl passwd -6 huggingrun)" user 2>/dev/null || true
40
+ # Root password for SSH login as root
41
+ RUN echo "root:huggingrun" | chpasswd 2>/dev/null || usermod -p "$(openssl passwd -6 huggingrun)" root
42
+ RUN mkdir -p /data
43
 
44
  # nginx + bridge + startup scripts
45
  COPY ubuntu-server/nginx.conf /etc/nginx/nginx.conf
ubuntu-server/start-server.sh CHANGED
@@ -92,6 +92,7 @@ echo "[start-server] Persistence background PID=$PERSIST_PID" >&2
92
  trap 'echo "[start-server] Saving system before exit..." >&2; save_system; exit 0' SIGTERM SIGINT
93
 
94
  # ── Phase 3: Start sshd ─────────────────────────────────────────────
 
95
  echo "[start-server] Starting sshd on 127.0.0.1:$SSH_PORT ..." >&2
96
  /usr/sbin/sshd -o "Port=$SSH_PORT" \
97
  -o "ListenAddress=127.0.0.1" \
 
92
  trap 'echo "[start-server] Saving system before exit..." >&2; save_system; exit 0' SIGTERM SIGINT
93
 
94
  # ── Phase 3: Start sshd ─────────────────────────────────────────────
95
+ mkdir -p /run/sshd
96
  echo "[start-server] Starting sshd on 127.0.0.1:$SSH_PORT ..." >&2
97
  /usr/sbin/sshd -o "Port=$SSH_PORT" \
98
  -o "ListenAddress=127.0.0.1" \
ubuntu-server/ws-ssh-bridge.py CHANGED
@@ -13,12 +13,16 @@ import sys
13
 
14
  try:
15
  import websockets
16
- from websockets.server import serve
17
  except ImportError:
18
  print("[ws-ssh-bridge] websockets not installed, pip installing...", file=sys.stderr)
19
  import subprocess
20
  subprocess.check_call([sys.executable, "-m", "pip", "install", "websockets", "-q"])
21
  import websockets
 
 
 
 
 
22
  from websockets.server import serve
23
 
24
  SSH_HOST = "127.0.0.1"
 
13
 
14
  try:
15
  import websockets
 
16
  except ImportError:
17
  print("[ws-ssh-bridge] websockets not installed, pip installing...", file=sys.stderr)
18
  import subprocess
19
  subprocess.check_call([sys.executable, "-m", "pip", "install", "websockets", "-q"])
20
  import websockets
21
+
22
+ # Support both old and new websockets API
23
+ try:
24
+ from websockets.asyncio.server import serve
25
+ except ImportError:
26
  from websockets.server import serve
27
 
28
  SSH_HOST = "127.0.0.1"