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.

This question already has an answer here:

I'm learning UBUNTU. I'm using virtual box with ubuntu image, i created my user name as joe no password. now that i try to execute any command that requires the sudo stuff it asks me for a password...this is weird because i didn't specify any password when loading the image into virtual box...is there a way to restore/reinitialize this password, i need it very bad for my homework, thanks guys

share|improve this question

marked as duplicate by Karan, Everett, Canadian Luke, wizlog, techie007 Feb 19 '13 at 12:27

This question has been asked before and already has an answer. If those answers do not fully address your question, please ask a new question.

1  
Since I don't think I can answer this any better than the answers here: askubuntu.com/questions/24006 ... use that link :) –  0xC0000022L Feb 19 '13 at 0:51
add comment

2 Answers

up vote 3 down vote accepted

You can do this by booting into single user mode and using root to change the password for the user joe. Edit the boot instructions for the GRUB menu entry you wish to boot and add the kernel parameter/option single.

  1. Select (highlight) the GRUB boot menu entry you wish to use.
  2. Press e to edit the GRUB boot commands for the selected boot menu entry.
  3. Look near the bottom of the list of commands for lines similar to

    linux /boot/vmlinuz-3.2.0-24-generic root=UUID=bc6f8146-1523-46a6-8b\
    6a-64b819ccf2b7 ro quiet splash
    initrd /boot/initrd.img-3.2.0-24-generic

  4. Change the middle line in (3) by adding the kernel boot parameter single to the end of the line (i.e. after ro quiet splash).

    For this example you would change
    6a-64b819ccf2b7 ro quiet splash
    to
    6a-64b819ccf2b7 ro quiet splash single

  5. Press either Ctrl+X or F10 to boot using these kernel options.

After this you will be thrown into a shell. Enter mount -o remount,rw / then the command passwd joe and enter your new password for joe. Restart with reboot or shutdown -r now.

share|improve this answer
2  
I may be missing something, but wouldn't you also have to -o remount,rw the root partition? How else would passwd write to the /etc/shadow file? –  0xC0000022L Feb 19 '13 at 0:48
    
You're right. I believe Ubuntu tells you the command to write to mount the correct drive as soon as you're thrown into the shell. –  에이바 Feb 19 '13 at 0:53
    
one word : THANKS :) –  joe Feb 19 '13 at 0:56
add comment

If account joe is just passwordless, joe can just log in and run passwd to give the account a new password.

share|improve this answer
add comment

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