Skip to content

fix: update fallback user in remote_user_run function to use current user#60

Open
darthrevan030 wants to merge 1 commit into
stu-bell:mainfrom
darthrevan030:fix/claude-code-remote-user-fallback
Open

fix: update fallback user in remote_user_run function to use current user#60
darthrevan030 wants to merge 1 commit into
stu-bell:mainfrom
darthrevan030:fix/claude-code-remote-user-fallback

Conversation

@darthrevan030
Copy link
Copy Markdown

@darthrevan030 darthrevan030 commented May 19, 2026

Fix: fall back to current user when UID 1000 does not exist

Problem:

When using this feature with standard Microsoft devcontainer base images (e.g. mcr.microsoft.com/devcontainers/typescript-node, python, go, cpp), the build fails with:
su: user vscode does not exist or the user entry does not contain all the required fields.

This happens because devcontainer features run during the Docker build phase, but the vscode user (UID 1000) is only created at container startup. So id -un 1000 fails and falls back to the hardcoded string "vscode", which doesn't exist in /etc/passwd at build time.

Fix

In util.sh, change the fallback in remote_user_run from:
sh_REMOTE_USER="$(id -un 1000 2>/dev/null || echo "vscode")" # vscode fallback
to:
sh_REMOTE_USER="$(id -un 1000 2>/dev/null || id -un)" # fallback to current user

id -un returns whoever is actually executing the script (root during build), which is guaranteed to exist. Claude Code's install script handles installing to the correct home directory regardless.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant