I added a new group (call it newgroup)

sudo groupadd newgroup

I then added my existing user (call him myuser) to newgroup

sudo usermod -a -G newgroup myuser

I log out and back in, and I check /etc/groups

$ less /etc/group | grep newgroup

So far, so good. However, I also have a new directory (call it newdir) with permissions drwxrwsr-x owner is root and group is newgroup. When I try to create a file in newdir as myuser, I get permission denied.

So I do an id check

$ id
uid=1000(myuser) gid=1000(myuser) groups=1000(myuser),4(adm),24(cdrom),27(sudo),30(dip),46(plugdev),118(lpadmin),128(sambashare),131(libvirt)

I'm not a part of newgroup. I also try groups just to be sure

$ groups
myuser adm cdrom sudo dip plugdev lpadmin sambashare libvirt

So what did I do wrong? Why is myuser a member of newgroup according to /etc/group but not anywhere else in the system?

Edit: The question linked to by muru referred to users that had not been logged out and logged back in. Therefore, rebooting resolved the problem. Coincidentally, rebooting solved my problem as well, but I was under the impression that logging a user out and back in would complete new group assignements.

  • 1
    Does newgroup newgrp work? – waltinator Aug 18 '18 at 3:21
  • I know this sounds silly, but are you sure you logged out completely... not just locked the screen? run sudo /etc/init.d/gdm restart or reboot – Joshua Besneatte Aug 18 '18 at 3:21
  • 4
    Possible duplicate of Peculiar permissions/group trouble – muru Aug 18 '18 at 3:36

Restarting solved the problem. I logged out and back in twice (the second time just to be sure I hadn't screwed something up somehow), but it seems to take a reboot for the new group association to take effect.

Sorry for the wild goose chase everyone. Is this something particular to Ubuntu (or Ubuntu Mate or 18.04)? I don't seem to remember having to fully reboot to associate users with groups before. I thought you just had to log out and back in if the user you were assigning was currently logged in.

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.