20

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.

1

6 Answers 6

16

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
1
  • 2
    To get the groups of a user you can also do: groups <username>
    – ehogue
    May 25, 2009 at 13:24
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
1
  • 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. May 23, 2009 at 1:16
2

For Ubuntu 14.04 LTS:

$USERNAME adm cdrom sudo dip plugdev lpadmin sambashare

2
  • Exact same as for Ubuntu 12.04 LTS, (which is in another answer), by the way. Jun 19, 2014 at 5: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, 2014 at 6: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.

4
  • So just admin and the username? Is that all for sure? May 23, 2009 at 0: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, 2009 at 0:37
  • That guy's book is based on Ubuntu 7.10. Probably you have something different.
    – jldugger
    May 23, 2009 at 4: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, 2009 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

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .