Skip to content

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
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:

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