I have an issue with login as root with in ubuntu.

I've mistakely assigning my user to a group as primary group and it is not anymore in sudoers. Consequently I cannot use "sudo" anymore.

I tried to login as "root" but it doesn't accept the password. Or maybe, it has never been assigned.

So... am I screwed ? Should I format the system and start over again ?

link|improve this question

Do you use Unix or Ubuntu? It's not the same thing. – Bobby Sep 23 '10 at 9:28
I use Ubuntu Server, does Ubuntu handle users differently ? – Patrick Sep 23 '10 at 10:05
Not directly, but possible solutions might differ. – Bobby Sep 23 '10 at 10:28
feedback

2 Answers

up vote 1 down vote accepted

Assuming that you use Ubuntu, you can select the recovery entry in the Grub boot menu. This will boot the system into the single-user mode, which will give you full root access, and the possibility to add your user back to the sudo-group.

link|improve this answer
IMHO this won't work: You'll have to enter root's password, which usually isn't set. – lajuette Sep 23 '10 at 9:30
1  
You don't have to. You will get root access without a password in recovery mode. – petersohn Sep 23 '10 at 10:01
lajuette, Ubuntu doesn't require a root password to boot single-user. Some distros do--but they have root passwords. – CarlF Sep 23 '10 at 13:26
feedback

no.

  1. Boot using a live CD (e.g. the Ubuntu installation cd).
  2. mount your root filesystem (mount /dev/yourRootDeviceHere /mnt/directoryYouMustCreateFirst)
  3. alter /mnt/directoryYouMustCreateFirst/etc/groups and add your user to sudoers again (or admin, or whatever group is allowed to sudo)
  4. unmount your root fs
  5. reboot
  6. be lucky!
link|improve this answer
feedback

Your Answer

 
or
required, but never shown

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