a member's terminal looks like the owner's

A new Linux account opens a shell with nothing: useradd copies /etc/skel, which on Ubuntu
is a bash rc, and the account's shell is zsh — so it got no prompt, no history, no
completion, no colour. "Their own account" should not mean a worse terminal than the
owner's.

src/servers/shell-skel/zshrc is the template, and scripts/starship.toml is reused rather
than copied: setup.sh already deploys it for the owner, so one file serves both audiences
and they cannot drift. Seeded by provisionOsAccount, which means the retry button applies
it to accounts that already exist — no delete-and-recreate.

The template depends on nothing but zsh. Starship, eza, nvim, bun, deno and cargo are each
used only if present, and every path is $HOME-relative — the owner's own .zshrc has three
absolute /home/pastilhas paths in it, which is exactly what a template must not inherit.
Without starship it falls back to a zsh prompt showing the same information, because a
shell that opens with a broken prompt reads as a broken machine.

Never overwrites: written only when the file is ABSENT. ~/.zshrc.local is sourced last and
never written, so there is somewhere to put your own config that no future template can
reach.

Three fixes found by running it:

- install -D creates missing parents but applies -o/-g only to the FILE, so ~/.config came
  out root:root — readable but not writable by its owner, which would have surfaced weeks
  later as one tool mysteriously failing. The parent is now created explicitly.
- useradd took its shell from process.env.SHELL, which under PM2 is whatever PM2 was
  launched from. A member's shell depended on how the server happened to be started. Now
  chosen from what is installed: zsh, else bash.
- the pty sidecar spawned ITS $SHELL for a member, not theirs. It now execs their passwd
  shell via sh -c, so the login shell in /etc/passwd is the one they get.

starship moves out of the light-profile skip. The light profile exists to serve a file
browser, a terminal and chat — the terminal is one of its three reasons to be, and it is
what every member gets. Leaving starship out meant the fallback prompt on exactly the
installs most likely to have members. oh-my-zsh, eza and lazygit stay full-only.

Verified in a real member shell: zsh from passwd, HISTFILE in their own home, eza-backed
ll, starship active, EDITOR=nvim, and an edit to .zshrc surviving a reprovision.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
This commit is contained in:
2026-08-11 19:43:55 +00:00
co-authored by Claude Opus 5
parent e4acf19a35
commit 71589aee99
6 changed files with 339 additions and 35 deletions
+10 -4
View File
@@ -94,10 +94,16 @@ function shellArgv(osUser) {
'--init-groups',
'--reset-env',
'--',
'env',
'COLORTERM=truecolor',
SHELL.command,
...SHELL.args,
// THEIR login shell, from their passwd entry — not this sidecar's `$SHELL`, which is whatever PM2 was
// started with. `--reset-env` has already set SHELL from passwd, so the indirection through `sh -c` is
// what reads it; there is no shell in an argv to expand a variable otherwise.
//
// `-i` rather than `-l`: interactive is what makes zsh read ~/.zshrc, which is the file the shell
// template writes. COLORTERM does not survive --reset-env and is restated here — it is how programs
// decide they may emit 24-bit colour.
'sh',
'-c',
'COLORTERM=truecolor exec "$SHELL" -i',
],
};
}