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

Bugfix: Fix error when creating user with PID 1001 and GID 1001 #140

Open
wants to merge 2 commits into
base: master
Choose a base branch
from

Conversation

h-arnold
Copy link

@h-arnold h-arnold commented Aug 2, 2024

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.

… trying to bring up the docker container which meant that none of the following samba account creation logic worked.

In the end, it turned out that swapping the creation of the linux user and groups around solved the problem because there was a GID conflict, but I thought the user account checking logic might be useful so I've left it in.

Hope you find this useful!
… being created and moved the group creation to after the the user creation so that if the GID is the same as the PID, you don't have a conflict which prevents the creation of the user account.
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.

1 participant