When trying to add my user to a new group to run an application (Kismet), I accidentally made it the ONLY group my user is in. I had run the groups command and saw seven or so other groups I was in, but when I logged out and logged back in to save my changes those other groups are gone.

I have root access, but my bash history doesn't show output.

How do I find out what groups I was in? I know how to add myself back to them, just not how to figure out what they were.

  • 1
    Backup copies of /etc/group? Find files you own that have gids not equal to kismet?
    – Jeff Schaller
    Commented Dec 18, 2016 at 3:34
  • The files thing is a clever idea, I ended up listing default groups and restoring those. Hoping I don't run into crazy access issues in the future now... Commented Dec 18, 2016 at 3:36

2 Answers 2


I had searched around previously, but just found this answer which basically solves my needs: Default groups for user in Ubuntu?

  1. Login as root (because I was removed from sudoers group):

    su - root

  2. List the setup log from creating my user

    grep user-setup /var/log/installer/syslog

  3. Then I ran the command (using the list of groups from the above command)

    usermod -a -G adm,cdrom,lpadmin,sudo,sambashare,dip username

  4. Log out and back in, done!


If you're still logged in anywhere, you can run the command groups to list the groups that the running process is in. If you're logged in on a terminal that you don't have access to, or more generally if you have a program running somewhere from before the group change, you can list that process's groups with ps -o rgroup,supgrp 1234 where 1234 is the process ID (that's for Linux, the syntax may be different on other Unix variants).

Whenever you change something about your account, it's a good idea to remain logged in and try logging in in another terminal to validate the change!

If you used vigr or some sufficiently compatible tool, it leaves a backup in /etc/group-. This does not apply to all tools, for example the addgroup command on Debian doesn't make a backup. Make a copy of the backup before editing the file again, otherwise it'll be overwritten.

It's a good idea to make frequent backups of /etc. I recommend using etckeeper (available on most Linux distributions) to keep a full history under version control (etckeeper automatically before and after installing packages, but you should commit all changes manually anyway with a meaningful log message).

  • 1
    "Whenever you change something about your account, it's a good idea to remain logged in and try logging in in another terminal to validate the change!" << Great advice, this would've prevented the issue. I also didn't know where to backup the list. Commented Dec 19, 2016 at 5:54

You must log in to answer this question.

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