19

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.

MikeyB
  • 38,725
  • 10
  • 102
  • 186
Wayne Koorts
  • 1,811
  • 1
  • 16
  • 21

6 Answers6

15

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
McLeopold
  • 103
  • 2
Wayne Koorts
  • 1,811
  • 1
  • 16
  • 21
4

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
Michael Havas
  • 698
  • 1
  • 6
  • 10
  • I forgot to mention that I don't have an Ubuntu box to verify this or know what version of Ubuntu these default groups belong to. It's a good starting point though. – Michael Havas May 23 '09 at 01:16
2

For Ubuntu 14.04 LTS:

$USERNAME adm cdrom sudo dip plugdev lpadmin sambashare

HopelessN00b
  • 53,385
  • 32
  • 133
  • 208
John Indra
  • 129
  • 2
  • Exact same as for Ubuntu 12.04 LTS, (which is in another answer), by the way. – HopelessN00b Jun 19 '14 at 05:43
  • Exact same? The answer for Ubuntu 12.04 LTS has "disk". There is no "disk" in my Ubuntu 14.04 LTS setup. Even if it's the exact same, I don't see providing the info as doing any harm :) – John Indra Jun 19 '14 at 06:03
1

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.

ehogue
  • 243
  • 2
  • 8
  • So just admin and the username? Is that all for sure? – Wayne Koorts May 23 '09 at 00:25
  • On a standard install that's all there is. At work we use Fedora and I know for sure that's all there is. And on my Ubuntu box here I only have my username and adm that I added after. – ehogue May 23 '09 at 00:37
  • That guy's book is based on Ubuntu 7.10. Probably you have something different. – jldugger May 23 '09 at 04:46
  • You're right. here are the groups I have on my desktop at the office: username adm dialout cdrom plugdev lpadmin admin sambashare dev . It looks like I killed all the groups on my home box. I probably forgot the -a on a usermod too. I do that all the time, but usually I print out the groups I have before the usermod to be able repair any screw up I might make. – ehogue May 25 '09 at 13:22
1

Ubuntu Server 9.10 (samba, openssh instaled)

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

1

Ubuntu 12.04 LTS:

$USERNAME adm disk cdrom sudo dip plugdev lpadmin sambashare

HopelessN00b
  • 53,385
  • 32
  • 133
  • 208
T'Saavik
  • 13
  • 3