-1

I inadvertently failed to append myself to a group by using usermod -G group_name user_name instead of usermod -aG group_name user_name and now belong only to the group_name group.

The problem is: I can not bring up the grub2 menu with Left-Shift on boot, therefore I can not drop to root login and reinstate my sudo membership.

Is there another way?

To be clear, I have not lost my password, I have inadvertently removed myself from the admin group.

  • 3
    You have to use a live flash drive. Oil's answer here describes how to do that - http://askubuntu.com/questions/24006/how-do-i-reset-a-lost-administrative-password (scroll down a bit) – Panther Mar 04 '16 at 14:09
  • 1
  • @bodhi.zazen So, boot a stick, mount the system root and edit sudoers? Or chroot into the system and usermod? – Tony Martin Mar 04 '16 at 14:19
  • 1
    Yeah, both of us read that. Did you care to read what we suggested? – muru Mar 04 '16 at 14:22
  • @muru beg your pardon, that should get me started! – Tony Martin Mar 04 '16 at 14:26
  • 1
    Editing sudoers is not the best option. Chroot into the system and restore your group memberships with usermod - http://askubuntu.com/questions/79565/add-user-to-existing-group – Panther Mar 04 '16 at 14:28
  • Thanks bodhi.zazen. I'll take that route.

    Vis the mark down. The combination of problems is particular. It is not entirely obvious that each of the two suggestions here is relevant after trawling through many suggestions that offer no solution. Should the question be deleted or left as a marker for others who find themselves unable to bring up the grub menu?

    – Tony Martin Mar 04 '16 at 14:33
  • 2
    IMO, go ahead and answer your own question. I would upvote a quality answer – Panther Mar 04 '16 at 14:47

1 Answers1

-1

Following the advice given here I did the following:

  1. Boot from the installation stick (or disk)
  2. In Unity bring up a terminal with ctrl+T. If the boot sequence stalls for any reason (graphics in my case) switch to another tty. I switched to tty2 with ctrl+alt+F2.
  3. Mount your system root drive. On my system this requires sudo mount /dev/sda2 /mnt
  4. Gain access to the installed system by chrooting into it. In my example I typed sudo chroot /mnt, because my system's root directory / is mounted there from the previous command. You now have a bash session in your original installation with full privileges.
  5. Enter usermod -aG sudo user_name
  6. Reboot normally.
  7. Rejoin all the default groups with

    sudo usermod -aG lpadmin,sambashare,adm,cdrom,dip,plugdev user_name
    
muru
  • 197,895
  • 55
  • 485
  • 740
  • Just stop using usermod for adding groups. This whole mess could have been avoided if you'd run adduser user_name group_name in the first place. – muru Mar 05 '16 at 08:25
  • So, @muru, the solution is to know everything about linux beforehand? I'll try to be omniscient in future. – Tony Martin Mar 05 '16 at 15:21
  • don't be stupid. Your problem was originally caused by you missing a crucial usermod option - -a. The solution is to be careful when you're messing with accounts. My comment was prompted by your continued usage of usermod when safer alternatives exist. – muru Mar 05 '16 at 15:24
  • I simply followed a tutorial on how to set up kismet, made a slip of the keyboard and found myself in the situation described. The tutorial did not offer alternatives. Nor did it offer a tutorial in all aspects of using and administering a Linux system. But thank you for the intelligence assessment. – Tony Martin Mar 06 '16 at 01:58
  • You're most welcome. – muru Mar 06 '16 at 01:59