From b5985f230e43b2f45266b2b1786b9fa2696487b1 Mon Sep 17 00:00:00 2001 From: Alexandre <44178713+alexbelgium@users.noreply.github.com> Date: Wed, 15 Jul 2026 11:01:22 +0200 Subject: [PATCH] Restore effective Claude runtime ownership --- .../cont-init.d/84-claude_runtime_ownership.sh | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) create mode 100644 claude_desktop/rootfs/etc/cont-init.d/84-claude_runtime_ownership.sh diff --git a/claude_desktop/rootfs/etc/cont-init.d/84-claude_runtime_ownership.sh b/claude_desktop/rootfs/etc/cont-init.d/84-claude_runtime_ownership.sh new file mode 100644 index 0000000000..45402914f4 --- /dev/null +++ b/claude_desktop/rootfs/etc/cont-init.d/84-claude_runtime_ownership.sh @@ -0,0 +1,17 @@ +#!/usr/bin/with-contenv bashio +# shellcheck shell=bash +set -e + +# Earlier configuration scripts intentionally run as root and may use the configured PUID/PGID +# values when returning files to the runtime user. In bypass mode PUID can still be configured as +# 0 even though 19-claude_bypass_runtime.sh remapped abc to a non-root UID. Reconcile ownership +# with the effective desktop identity after all Claude configuration writes are complete. +RUNTIME_UID="$(id -u abc)" +RUNTIME_GID="$(id -g abc)" + +for managed_path in "$HOME/.claude" "$HOME/.claude.json" "$HOME/.config/Claude"; do + if [ -e "$managed_path" ]; then + chown -R -- "${RUNTIME_UID}:${RUNTIME_GID}" "$managed_path" \ + || bashio::log.warning "Unable to set effective runtime ownership on $managed_path" + fi +done