Closed tirolerstefan closed 1 year ago
So basically docker is not initializing the group vector for you. Have you tried adding the following to /etc/sudo.conf?
Set group_source dynamic
That will cause sudo to query the group list from the group database instead of the kernel.
... and that works. Thanks you!
Closing this since it is really a docker issue and sudo provides a work-around.
I have a situation in an Ubuntu 18.04 docker container where my user gets rejected by sudo:
[user] is not in the sudoers file. This incident will be reported.
My user has main group membership 100 (users) and is member of groups:
adm dialout cdrom sudo plugdev lpadmin sbuild vboxusers docker
(ids:4,20,24,27,46,100,116,127,134,999
). I have debugged the situation with a sudo_debug logfile and rebuilt sudo from jammy (1.9.9).In method
get_user_groups
, thegetgroups
from libc returns 1 group (the main group):Debug log:
Then I adapted the code and added
initgroups
to check whether the situation improves:-> and then, it worked.
Debug log:
Ok, initgroups is not ideal with argument 0, because group 0 is added to the list of groups. But do you have a hint, why the supplementary groups are not returned in this case (without using initgroups) or how I could solve that situation?
Additional info for docker:
I start it with following cmd:
docker run -it -w "$(pwd)" --user $UID:$GID --volume="/etc/passwd:/etc/passwd:ro" --volume="/etc/shadow:/etc/shadow:ro" --volume="/etc/group:/etc/group:ro" -v /home:/home -e DISPLAY=$DISPLAY [my_image]
Thanks for any help!