Skip to content

Fix sed command to remove last line in sudoers file#7792

Open
stuartpb wants to merge 1 commit into
coder:mainfrom
stuartpb:patch-1
Open

Fix sed command to remove last line in sudoers file#7792
stuartpb wants to merge 1 commit into
coder:mainfrom
stuartpb:patch-1

Conversation

@stuartpb
Copy link
Copy Markdown

This way the DOCKER_USER variable won't accidentally retain sudoer permissions for any user not named coder (almost certainly a security hole).

This way the `DOCKER_USER` variable won't accidentally retain sudoer permissions for any user not named `coder` (almost certainly a security hole).
@stuartpb stuartpb requested a review from a team as a code owner May 11, 2026 04:53
@code-asher
Copy link
Copy Markdown
Member

code-asher commented May 12, 2026

How would this be reproduced? We create the coder user as part of the image so it will always be the right user to remove:

&& adduser --gecos '' --disabled-password coder \
&& echo "coder ALL=(ALL) NOPASSWD:ALL" >> /etc/sudoers.d/nopasswd

If the user is not coder somehow, then these previous lines trying to rename it will fail anyway.

sudo usermod --login "$DOCKER_USER" coder
sudo groupmod -n "$DOCKER_USER" coder

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