I'm on a fresh installation of Ubuntu 18.04. During installation, I chose the minimal installation instead of the standard one.
I just added myself to the docker
group using the following command
sudo usermod -a -G docker danny
I have logged out from my GNOME session (I tried both, from the top bar's menu, and from searching for "logout"). But my user did not get assigned to the docker
group. However, if I su
into my user, the group is there so the previous command did not fail.
$ groups
danny adm cdrom sudo dip plugdev lpadmin sambashare
$ groups danny
danny adm cdrom sudo dip plugdev lpadmin sambashare docker
$ su - danny
$ groups
danny adm cdrom sudo dip plugdev lpadmin sambashare docker
I had to do a full OS reboot for the change to take effect.
I have already rebooted, but this the ouput of id
;
$ id
uid=1000(danny) gid=1000(danny) groups=1000(danny),4(adm),24(cdrom),27(sudo),30(dip),46(plugdev),116(lpadmin),126(sambashare),999(docker)
But I'm wondering why logging out isn't enough?
P.S. I am able to reproduce this behavior by adding myself to any random group, not just docker
.
You can also use the
newgrp
command to join a new group:I must confess that I'm as surprised as you that logout / login doesn't assign the new group, but
su -
does.You don't need to reboot to assign the additional group to your user. In the running shell the group assignment doesn't change, but it does in a new shell: