1

I use ubuntu 18.04. I created a new group:

sudo groupadd group_1

Next I added myself to the group:

sudo usermod -aG group_1 $USER

After logging out and logging in it appears as if I am not a member of the group:

johan@johan-VirtualBox:~$ groups
johan adm cdrom sudo dip plugdev lpadmin sambashare vboxsf

I have to run su - $USER for the group to show:

johan@johan-VirtualBox:~$ su - $USER
johan@johan-VirtualBox:~$ groups
johan adm cdrom sudo dip plugdev lpadmin sambashare docker vboxsf group_1 

What is wrong?

Johan hvn
  • 281

2 Answers2

0

In a case of the currently logged-in user being added to a newly created group, a reboot of the OS might be needed for the groups command to show the new group.

Zheng
  • 1
  • 1
-1

Johan:

Try with newgrp command:

johan@johan-VirtualBox:~$ newgrp group_1

With this command you can log in to a new group without reload session:

$ -> whatis newgrp
newgrp (1)           - log in to a new group

I hope I have been helpful.

Adrian
  • 174