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.

link|improve this question
feedback

4 Answers

up vote 9 down vote accepted

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
link|improve this answer
2  
To get the groups of a user you can also do: groups <username> – ehogue May 25 '09 at 13:24
feedback

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
link|improve this answer
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 1:16
feedback

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.

link|improve this answer
So just admin and the username? Is that all for sure? – Wayne Koorts May 23 '09 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 '09 at 0:37
That guy's book is based on Ubuntu 7.10. Probably you have something different. – jldugger May 23 '09 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 '09 at 13:22
feedback

Ubuntu Server 9.10 (samba, openssh instaled)

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

link|improve this answer
feedback

Your Answer

 
or
required, but never shown

Not the answer you're looking for? Browse other questions tagged or ask your own question.