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 newgroup:x:1001:myuser
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.
sudo /etc/init.d/gdm restartor reboot