restore password in ubuntu

2

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

joe

Posted 2013-02-19T00:28:59.870

Reputation: 141

Question was closed 2013-02-19T12:27:50.783

1

Since I don't think I can answer this any better than the answers here: http://askubuntu.com/questions/24006 ... use that link :)

– 0xC0000022L – 2013-02-19T00:51:01.343

Answers

3

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.

에이바

Posted 2013-02-19T00:28:59.870

Reputation: 1 266

2I 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 – 2013-02-19T00:48:54.073

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. – 에이바 – 2013-02-19T00:53:14.247

1

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

vonbrand

Posted 2013-02-19T00:28:59.870

Reputation: 2 083