How can I re-instate my admin privileges?

I am running 12.04 LTS. It's a pretty default installation and is the only OS on this machine.

I have two users one has administrator rights the other does not. I accidentally removed administrator rights from the "admin" user.

I tried to add myself back as a sudo user but that requires reaching GRUB during boot but I cannot get there because my /etc/default/grub has GRUB_HIDDEN_TIMEOUT=0 and changing that to a positive integer requires admin privileges to save the changes and run sudo update-grub.

Should I boot from LiveCD? The Reasons for Using a LiveCD Session discouraged my a bit. Right now all I have handy is an install DVD from 11.10, but that did not help me much.

Not sure what to do now.

Any suggestions?

NOTE: 12.04 does not have an admin group and I have not enabled root


Solution 1:

Hold SHIFT right after BIOS posts. That should get you into the GRUB menu regardless of whether your GRUB_HIDDEN_TIMEOUT is set to zero or not.

From the GRUB menu, select your most recent kernel tagged with "(recovery mode)". Once that finishes loading, you should be presented with a menu that has an option to "drop to root shell prompt". You might have to arrow-down to see it.

recovery menu

That should get you to the command line as the root user. From there you should be able to re-add yourself as a sudo user. Note that you might have a read-only filesystem at that point. If so, run the below command:

mount -o remount,rw /

Solution 2:

sudo adduser my_user_name admin will add an existing user called my_user_name into the admin group.

sudo adduser new_user_name will add a new user

sudo adduser my_user_name root will add an existing user called my_user_name into the root group.

Once you can load Ubuntu and get into the Desktop you can download an application for modifying users rights and groups. Open a Terminal and type:

sudo apt-get install users-admin