Terminal: show the live full working-directory path in the toolbar
Deploy Ladill Hosting / deploy (push) Successful in 45s

The toolbar showed a static ~/public_html. The jailed shell now reports its cwd
via OSC 7 each prompt (jail rcfile keeps the user's prompt + emits it); xterm
captures it and the toolbar shows the full path (/home/<user>/...), updating as
the user cd's. Launcher/rcfile committed in deployment/ for reproducibility.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This commit is contained in:
isaacclad
2026-06-27 07:53:48 +00:00
co-authored by Claude Opus 4.8
parent d7b47e67fb
commit 75ba450938
5 changed files with 31 additions and 3 deletions
+8
View File
@@ -0,0 +1,8 @@
# Ladill jail interactive shell rc: keep the user's shell config, start in the
# requested directory, and report the working directory to the control panel via
# OSC 7 on every prompt so the toolbar shows the live full path.
[ -r /etc/bash.bashrc ] && . /etc/bash.bashrc
[ -r "$HOME/.bashrc" ] && . "$HOME/.bashrc"
[ -n "${LADILL_START_DIR:-}" ] && cd "$LADILL_START_DIR" 2>/dev/null
__ladill_cwd() { printf '\033]7;file://%s%s\007' "${HOSTNAME:-ladill}" "$PWD"; }
case "$-" in *i*) PROMPT_COMMAND="__ladill_cwd${PROMPT_COMMAND:+; $PROMPT_COMMAND}"; __ladill_cwd ;; esac
+2 -2
View File
@@ -28,5 +28,5 @@ mount -t tmpfs -o mode=0755,nosuid,nodev tmpfs "$JAIL/run"
mount --bind "$JAIL/run/passwd" "$JAIL/etc/passwd"
mount --bind "$JAIL/run/group" "$JAIL/etc/group"
export HOME="/home/$U" USER="$U" LOGNAME="$U" SHELL=/bin/bash PATH=/usr/bin:/bin
export TERM="${TERM:-xterm-256color}"
exec /usr/sbin/chroot --userspec="$UID_:$GID_" "$JAIL" /bin/bash -l -c "cd '/home/$U$REL' 2>/dev/null || cd ~; exec /bin/bash -l"
export TERM="${TERM:-xterm-256color}" LADILL_START_DIR="/home/$U$REL" HOSTNAME="$(hostname 2>/dev/null || echo ladill)"
exec /usr/sbin/chroot --userspec="$UID_:$GID_" "$JAIL" /bin/bash --rcfile /etc/ladill-jail-bashrc -i
+3
View File
@@ -27,6 +27,9 @@ install -d -m 1777 "$JAIL/tmp"
# any customer enumerate every tenant. ladill-jailsh injects a per-session
# passwd/group (root + the current user only) inside each session's namespace.
echo "==> Installing the interactive rc (keeps user prompt + reports cwd via OSC 7)"
install -o root -g root -m 644 "$(dirname "$0")/ladill-jail-bashrc" "$JAIL/etc/ladill-jail-bashrc"
echo "==> Installing the jailed-shell launcher + scoped sudoers"
install -o root -g root -m 755 "$(dirname "$0")/ladill-jailsh" /usr/local/sbin/ladill-jailsh
echo 'www-data ALL=(root) NOPASSWD: /usr/local/sbin/ladill-jailsh *' > /etc/sudoers.d/ladill-jailsh