Skip to content

Use dropbear -e to forward container env to SSH sessions - #13

Merged
dtinth merged 2 commits into
mainfrom
claude/add-ssh-server-ITHUw
May 9, 2026
Merged

dtinth merged 2 commits into
mainfrom
claude/add-ssh-server-ITHUw

Conversation

@dtinth

@dtinth dtinth commented May 9, 2026 •

Copy link
Copy Markdown
Owner

Summary

Replace the profile.d file-writing approach with dropbear's built-in -e flag, which passes the daemon's environment directly to every login shell.

Since the dropbear service runs under with-contenv, it already holds the full container environment. With -e, that env is forwarded to SSH sessions verbatim — TZ, XDG_RUNTIME_DIR, DISPLAY, and everything else. This also means GUI apps can be launched directly from an SSH session since DISPLAY=:1.0 is forwarded.

This approach is cleaner and completely generic: it requires no knowledge of which specific vars matter, and works correctly on any image that uses with-contenv to set up the container environment.

Also removes the profile.d file-writing logic from the init script that was manually exporting just TZ and XDG_RUNTIME_DIR.

Test plan

  • env over SSH matches the GUI terminal env closely
  • Correct timezone over SSH
  • zellij attach over SSH finds GUI sessions
  • A GUI app (e.g. xterm) launched over SSH appears on the desktop

https://claude.ai/code/session_01XrvMKQ6TFAUnXn7Mw7dt5q

claude added 2 commits May 9, 2026 12:09
Dropbear login shells don't inherit the container environment, so TZ
and XDG_RUNTIME_DIR are absent over SSH. This breaks timezone display
and prevents tools like zellij from finding sessions started from the
GUI (which sets XDG_RUNTIME_DIR=/config/.XDG for its socket path).

The init script now writes /etc/profile.d/devtop-env.sh at startup,
sourced automatically by every SSH login shell.

https://claude.ai/code/session_01XrvMKQ6TFAUnXn7Mw7dt5q
dropbear -e passes the daemon's environment (loaded via with-contenv)
to every login shell, making TZ, DISPLAY, XDG_RUNTIME_DIR and all
other container vars available over SSH automatically — no profile.d
workarounds needed. Also enables launching GUI apps from SSH since
DISPLAY is forwarded.

Remove the profile.d file-writing logic from the init script.

https://claude.ai/code/session_01XrvMKQ6TFAUnXn7Mw7dt5q
@dtinth dtinth changed the title Write container env vars to profile.d for SSH sessions Use dropbear -e to forward container env to SSH sessions May 9, 2026
@dtinth
dtinth merged commit 25c2021 into main May 9, 2026
1 check passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants