1

I am running Ubuntu 17.04.

I am simply trying to add my existing user account to the lxd group and I expect to be able to verify that I am in that group with the "groups" command.

I tried the things in How to add existing user to an existing group? but I am puzzled by what I found:

Listing what my current groups:

drunkard@thebar:~$ groups
drunkard adm cdrom sudo dip plugdev lpadmin sambashare

Trying to add lxd group to my user account:

drunkard@thebar:~$ sudo usermod -a -G lxd drunkard
[sudo] password for drunkard:

List the current groups:

drunkard@thebar:~$ groups
drunkard adm cdrom sudo dip plugdev lpadmin sambashare

Sure. I have to log out and login again. So as a short cut I will login as a subshell with:

drunkard@thebar:~$ su - drunkard
Password: 

Now, surely the groups listed should include lxd:

drunkard@thebar:~$ groups
drunkard lxd

Huh? What happened? Where did the existing groups go? I used the -a option!

Ok, being confused, I exited that shell and tried this:

drunkard@thebar:~$ sudo usermod -a -G lxd,drunkard,adm,cdrom,sudo,dip,plugdev,lpadmin,sambashare drunkard
drunkard@thebar:~$ su - drunkard
Password: 
drunkard@thebar:~$ groups
drunkard adm cdrom sudo dip plugdev lpadmin sambashare lxd

ok, there they are, but then logging completely out and back in again, I see "lxd" is missing:

drunkard@thebar:~$ groups
drunkard adm cdrom sudo dip plugdev lpadmin sambashare

Hunting around, I found this command:

drunkard@thebar:~$ getent group lxd
lxd:x:136:drunkard

Apparently my user account is in the lxd group, but why in the heck is the groups command not showing it?

drunkard@thebar:~$ groups
drunkard adm cdrom sudo dip plugdev lpadmin sambashare

What nuance am I missing here?


EDIT #1: The lxc command seems to indicate that I am not in lxd group:

drunkard@thebar:~$ lxc launch ubuntu: first-machine
Permission denied, are you in the lxd group?
drunkard@thebar:~$ getent group lxd
lxd:x:136:drunkard
drunkard@thebar:~$ sudo adduser drunkard lxd
[sudo] password for drunkard: 
The user `drunkard' is already a member of `lxd'.
drunkard@thebar:~$

EDIT #2:

After rebooting, I am now able to see my user account added to the group and the lxc command works without sudo. Why? I should have to only logout and log back in again, not a full reboot, right?

bgoodr
  • 1,562
  • 3
  • 20
  • 34
  • I don't know what happened to your groups. You can verify the groups your user is belonging to with grep drunkard /etc/group. – muclux Dec 09 '17 at 07:41
  • Yes that is what is puzzling me. I've got it fixed, but it is disconcerting that a reboot is what was required (hearkens back to MS Windows days). – bgoodr Dec 09 '17 at 18:47

0 Answers0