Skip to content

fix: run code-server as the appropriate user #1

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 3 commits into from
Apr 8, 2025

Conversation

DanielleMaywood
Copy link
Collaborator

Rather than run code-server as root, we instead run it as the appropriate user.

Rather than run code-server as root, we instead run it as the
appropriate user.
@DanielleMaywood DanielleMaywood self-assigned this Apr 8, 2025
@DanielleMaywood DanielleMaywood marked this pull request as ready for review April 8, 2025 10:38
@DanielleMaywood DanielleMaywood requested a review from mafredri April 8, 2025 10:39
@@ -22,7 +22,7 @@ cat > /usr/local/bin/code-server-entrypoint \
#!/usr/bin/env bash
set -e

code-server --bind-addr "$HOST:$PORT" \$ARGS
runuser -l $_REMOTE_USER -c 'code-server --bind-addr "$HOST:$PORT" \$ARGS'
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is there anything that guarantees runuser is present? I know it's present in both Debian and Ubuntu, but for instance containers like Alpine and Fedora don't have it.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

That's a good point, I've switched to su instead.

Some linux distributions do not ship with runuser
Copy link
Member

@mafredri mafredri left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

:shipit:

@@ -22,7 +22,7 @@ cat > /usr/local/bin/code-server-entrypoint \
#!/usr/bin/env bash
set -e

code-server --bind-addr "$HOST:$PORT" \$ARGS
su $_REMOTE_USER -c 'code-server --bind-addr "$HOST:$PORT" \$ARGS'
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sanity check: Is this remote user env always set?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@DanielleMaywood DanielleMaywood merged commit a49fbbb into main Apr 8, 2025
7 checks passed
@DanielleMaywood DanielleMaywood deleted the dm-run-user-at-right-perm-level branch April 10, 2025 09:55
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.

2 participants