diff --git a/CHANGELOG.md b/CHANGELOG.md index d1f5ca2810f..74ebdce9f0f 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -37,6 +37,7 @@ Docs: https://docs.openclaw.ai - Docs/browser: add a layered WSL2 + Windows remote Chrome CDP troubleshooting guide, including Control UI origin pitfalls and extension-relay bind-address guidance. (#39407) Thanks @Owlock. - Context engine registry/bundled builds: share the registry state through a `globalThis` singleton so duplicated bundled module copies can resolve engines registered by each other at runtime, with regression coverage for duplicate-module imports. (#40115) thanks @jalehman. - macOS/Tailscale gateway discovery: keep Tailscale Serve probing alive when other remote gateways are already discovered, prefer direct transport for resolved `.ts.net` and Tailscale Serve gateways, and set `TERM=dumb` for GUI-launched Tailscale CLI discovery. (#40167) thanks @ngutman. +- Podman/setup: fix `cannot chdir: Permission denied` in `run_as_user` when `setup-podman.sh` is invoked from a directory the target user cannot access, by wrapping user-switch calls in a subshell that cd's to `/tmp` with `/` fallback. (#39435) Thanks @langdon and @jlcbk. ## 2026.3.7 diff --git a/setup-podman.sh b/setup-podman.sh index 95a4415487c..5b904684ffa 100755 --- a/setup-podman.sh +++ b/setup-podman.sh @@ -80,12 +80,17 @@ run_root() { } run_as_user() { + # When switching users, the caller's cwd may be inaccessible to the target + # user (e.g. a private home dir). Wrap in a subshell that cd's to a + # world-traversable directory so sudo/runuser don't fail with "cannot chdir". + # TODO: replace with fully rootless podman build to eliminate the need for + # user-switching entirely. local user="$1" shift if command -v sudo >/dev/null 2>&1; then - sudo -u "$user" "$@" + ( cd /tmp 2>/dev/null || cd /; sudo -u "$user" "$@" ) elif is_root && command -v runuser >/dev/null 2>&1; then - runuser -u "$user" -- "$@" + ( cd /tmp 2>/dev/null || cd /; runuser -u "$user" -- "$@" ) else echo "Need sudo (or root+runuser) to run commands as $user." >&2 exit 1