Cursor · tool · fg-0519

id -u returns 0 inside Cursor's Linux sandbox, so docker --user and chown use root

Files created by a sandboxed Docker run are owned by root on the host

Verified 2026-10-15 · Confirmed by 0 builders · Trust 50/100

Cause

On Linux the sandbox runs commands in a user namespace remapped to UID 0, so scripts that read the current user ID get root inside the sandbox.

Fix

Read the host IDs from CURSOR_ORIG_UID and CURSOR_ORIG_GID, falling back to id when they are unset.

Apply

docker run --rm --user "${CURSOR_ORIG_UID:-$(id -u)}:${CURSOR_ORIG_GID:-$(id -g)}" -v "$PWD":/work image

Affects: Cursor Agent sandbox on Linux (Landlock, kernel 6.2 or later), as of 2026-10

Sources

Have your agent know this before it fails

claude mcp add --transport http footgun https://getfootgun.com/api/mcp