Take the 2-minute tour ×
Server Fault is a question and answer site for professional system and network administrators. It's 100% free, no registration required.

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.

share|improve this question

6 Answers 6

Ubuntu 12.04 LTS:

$USERNAME adm disk cdrom sudo dip plugdev lpadmin sambashare

share|improve this answer

For Ubuntu 14.04 LTS:

$USERNAME adm cdrom sudo dip plugdev lpadmin sambashare

share|improve this answer
    
Exact same as for Ubuntu 12.04 LTS, (which is in another answer), by the way. –  HopelessN00b Jun 19 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 at 6:03
    
Fair enough, then. Have an upvote. –  HopelessN00b Jun 19 at 8:44
up vote 14 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
share|improve this answer
2  
To get the groups of a user you can also do: groups <username> –  ehogue May 25 '09 at 13:24

Ubuntu Server 9.10 (samba, openssh instaled)

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

share|improve this answer

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.

share|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

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
share|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

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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