Skip to content
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

Docker: Only switch user if the current user is root #7654

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

skylenet
Copy link
Contributor

One might be running the container without root (e.g. docker run --user youruser ... ), if that's the case you'll get an error like this when running su:

Password: su: Authentication failure

@@ -45,5 +45,10 @@ done
# Construct the command as a single string
COMMAND="/opt/besu/bin/besu $@"

# Switch to the besu user and execute the command
exec su -s /bin/bash $BESU_USER_NAME -c "$COMMAND"
# Check if current user is root
Copy link
Contributor

Choose a reason for hiding this comment

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

Make sense, and probably if not root we can skip the all the part that fixes path permission, so I suggest to move this check at the very beginning of the script and if root just exec Besu, otherwise run the rest of the script, wdyt?

FYI @pullurib

Copy link
Contributor

Choose a reason for hiding this comment

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

Yes, I agree, a check at very beginning of the script and if not root, just exec'ing Besu should be good.

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.

3 participants