Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

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 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, Ƭᴇcʜιᴇ007 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.

Since I don't think I can answer this any better than the answers here: ... use that link :) – 0xC0000022L Feb 19 '13 at 0:51
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
    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
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

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

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