How to reset password in Ubuntu Virtual Machine

Symptoms

I want to reset my password in Ubuntu virtual machine.

Resolution

  1. Go to virtual machine’s **Configuration->Hardware Tab -> Boot Order.
  2. Tick ‘Select boot device on startup’
  3. Run Ubuntu.
  4. Right after start target virtual machine (click inside virtual machine window) and press Shift key repeatedly until you will see the grub menu.
  5. From the boot menu, select recovery mode, which is usually the second boot option.
  6. After you select recovery mode and wait for all the boot-up processes to finish, you’ll be presented with a few options. In this case, you want the Drop to root shell prompt option so press the Down arrow to get to that option, and then press Enter to select it.The root account is the ultimate administrator and can do anything to the Ubuntu installation (including erase it), so please be careful with what commands you enter in the root terminal.In recent versions of Ubuntu, the filesystem is mounted as read-only, so you need to enter the follow command to get it to remount as read-write, which will allow you to make changes: mount -o rw,remount /
  7. If you have forgotten your username as well, type: ls /home
  8. To reset the password, type: passwd username Where username is the username you want to reset.
  9. You’ll then be prompted for a new password. When you type the password you will get no visual response acknowledging your typing. Your password is still being accepted. Just type the password and hit Enter when you’re done. You’ll be prompted to retype the password. Do so and hit Enter again.
  10. Now the password should be reset. Type exit to return to the recovery menu.
  11. After you get back to the recovery menu, select resume normal boot, and use Ubuntu as you normally would.