I've just installed Xubuntu 18.04 (Bionic) and facing this issue, I wanted to report this as a bug on launchpad but thought of confirming it from here first. Thing is that when I add a group to the user like below, it should take effect on the next user login, right?

sudo usermod -aG docker prahlad

This behavior used to work until 16.04 from what I remember, but today I logged out and back in several times, yet when I see my groups by running the groups command, I'm unable to see docker added to it. However, when I created a new shell, I was able to see the new group:

su prahlad -

And of course, when I rebooted my laptop completely, I was able to able to see the docker group. Can somebody confirm whether this is a new issue introduced in Bionic? Or maybe, it just happens with docker installed?


It's NOT "an issue", it's just how groups work.

The login program reads /etc/groups to set the group membership of your initial process, which will be inherited downwards to processes it creates.

Eventually, a process does sudo usermod -aG docker prahlad, which updates /etc/groups, but, by design, does NOT change the group membership of the parent of the parent of the process that ran sudo usermod -aG docker prahlad, nor does it run login to edit your processes' group memberships.

As a long time sysadmin, I'm sure I want to be able to add some random user to some random group WITHOUT messing with MY group memberships.

If you want to make immediate use of your new group membership, you could read man newgrp, and do:

sudo usermod -aG docker prahlad
newgrp docker

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.