Bugfix: Fix error when creating user with PID 1001 and GID 1001 #140
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
I tried to set up your lovely docker container with my usual settings which require the user to have a PID and GID of 1001. Doing this resulted in the error:
samba-1 | adduser: uid '1001' in use
. For some reason, the user 1001 appears to be taken in the base docker image, whether I pull the current one or build it from scratch.I added logic to the
entrypoint.sh
script to check if a user with the same PID already exists and if it does, to delete it before creating a fresh user. I also moved the group creation logic to after the user creation because otherwise a GID conflict (if your PID and GID are the same) prevents the user from being created.These two changes appear to solve that problem.