8

Can someone post the groups your first Ubuntu accounts are in? I tried to add my account to a group but it removed all other groups.

I remember it was part of adm, sudo etc etc. There's no way to revert it I guess? Now I think I should boot into recovery to add the main account to other groups

limit
  • 81

1 Answers1

9

The default groups are:

{user} adm cdrom sudo dip plugdev lpadmin sambashare

Where {user} is your username.

When adding new groups to your user on the command-line, to avoid losing membership of other groups, use:

sudo usermod -aG {group1},{group2},{group3} {user}

The -a option of usermod appends the new group onto your user's list of groups, without that you'll overwrite all other groups.

Unfortunately, as you've taken yourself out of the sudo group, you won't be able to complete this command. If you have another sudo user on the system that you have access to, you could use them to reset your groups, otherwise you will need to boot to recovery, and drop to a root shell, to recover the groups using the usermod command above, although as root, you won't need sudo.

Arronical
  • 19,893
  • 2
    Cool. Thanks. I had tried useradd -aG but it didn't work so i tried usermod -G without a which messed up. – limit Jul 25 '16 at 13:37