Scenario / Questions

I just made a silly mistake on my Ubuntu Server box: I added myself to a group using usermod -G, after which I discovered the -a option…

The result is that I am now out of the admin group, and lost my sudo rights. I can sort that out, but I want to know what other groups I may been removed from? My user was the first one so what I’m looking for is a list of groups that the first user gets added to at installation time.

Find below all possible solutions or suggestions for the above questions..

Suggestion: 1

Michael’s answer was the closest, but I wanted to be sure, so I installed a fresh copy of Ubuntu Server 8.04.2 (Hardy Heron) in a virtual machine to get the official group list. The installation was a basic one with no specific server roles selected. These are the first groups, assigned by default, to the first user:

  • $USERNAME (e.g. wayne) (primary group – the rest are supplementary groups)
  • adm
  • dialout
  • cdrom
  • floppy
  • fuse
  • audio
  • dip
  • video
  • plugdev
  • sambashare
  • lpadmin
  • admin

To assign these groups to a given user, issue the following command:

sudo usermod -a -G adm,dialout,cdrom,floppy,audio,dip,fuse,video,plugdev,scanner,sambashare,lpadmin,admin

The -a switch means “append” so that existing supplementary groups are not overwritten.

To get a list of groups assigned to a particular user:

cat /etc/group | grep <username> 

or for the current user:

groups

Suggestion: 2

From here, the default groups for the first user on an Ubuntu box are:

  • $USERNAME (Primary)
  • adm
  • dialout
  • cdrom
  • floppy
  • audio
  • dip
  • video
  • plugdev
  • scanner
  • netdev
  • lpadmin
  • powerdev
  • admin

Suggestion: 3

For Ubuntu 14.04 LTS:

$USERNAME adm cdrom sudo dip plugdev lpadmin sambashare

Suggestion: 4

The default group should be the same as the user name. So if you created user1, his default group would be user1.

[Edit]

Here you have an explanation of the group memberships.

Suggestion: 5

Ubuntu Server 9.10 (samba, openssh instaled)

$username, adm, dialout, cdrom, plugdev, sambashare, lpadmin, admin

Suggestion: 6

Ubuntu 12.04 LTS:

$USERNAME adm disk cdrom sudo dip plugdev lpadmin sambashare