Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

I removed (distrattament) my "sudo" user from sudo group user, I can't use root because I don't know a password for root.

I have an Ubuntu virtual machine and when I open Recovery Menu is limited read-only menu. If I select "root Drop to root shell prompt" the message is "Give root password for maintenance" ... but I don't know the root password.

How can I reset root password?

share|improve this question
add comment

1 Answer

To recover the root password, you will need to boot into single user mode. In many distrobutions there is a drop down option to let you select at the boot loader. If you are using GRUB, you can select the version of the OS kernel you would like to boot, hit the "edit" key (e I believe), and then append the word "single" to the end of the kernel parameters string. You can find Ubuntu specific instructions here.

Once you have booted into single user mode, you should see a prompt like this:

sh#

To reset the root password, type:

passwd root

At this point you will be prompted to enter a new password and to confirm the password. You can also modify the /etc/sudoers file to add your user back to the sudoers group.

share|improve this answer
1  
Note, you should modify the /etc/sudoers file and add yourself back to sudoers instead of enabling the root account. The root account is disabled for a reason. –  Darth Android Apr 25 '13 at 15:22
    
I disagree on that front - I work on Solaris, HPUX, and Red Hat boxes all day, and we have never had an issue with root login being enabled. Especially given a lot of apps we run require root SUID. If someone has absolutely no idea what they are doing, maybe it is a valid precaution. But I tend to consider it security by obscurity - the root account still exists (and you can exploit up to it), the wheel group still exists. Different approaches I guess :) –  Matthew Apr 25 '13 at 16:06
1  
@Matthew: Which means you really aren't the target market for Ubuntu. The Ubuntu wiki has a good breakdown of the advantages and disadvantages of using sudo over root. –  harbichidian Apr 25 '13 at 16:11
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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