vibura
Last Updated: July 13, 2017
·
42.5K
· mathias
311c342bfd324eb9d3603222f7f36f24

Reset a lost password on an Ubuntu VM

You may be like me and keep a couple virtual machines around on your laptop for development, testing, and gaming. I had an Ubuntu VM in VMWare that I'd lost the password to, and I wanted to reset it so that I could get back to coding.

Typically, with a desktop computer or a server, you hold down some key while the computer is booting to get into the Grub boot manager and then boot into something called "single user mode", where you're able to change passwords, fix configs, repair disks, etc.

Unfortunately, the boot screen just flies right by in Ubuntu under VMWare. So the first thing you'll need to do is shut down the VM, and then get ready to start it up. But before you start the VM: get ready to hit Shift because that's what will get you into Grub. Ready? Ok. Boot it and hit Shift.

Now you should be in Grub. If you don't get it, don't worry, just shut down and try again.

Choose the 'Advanced Options' and then any of the "recovery" lines from the Grub menu for Ubuntu.

You'll get dropped into another menu system. Choose 'root': this is the single-user mode where you are root.

Your / filesystem may be mounted as read-only at this point. Type this to mount it as read-write:

mount -rw -o remount /

Now you can reset passwords, etc, like this:

passwd myuser

Good luck!

Say Thanks
Respond

6 Responses
Add your response

13913
23cecb6d0610a0ffd7b8c2dee2911d13

Saved my butt! Thanks Matt =D

over 1 year ago ·
18669

but i forgot my password.. is there some way that i can still login??

over 1 year ago ·
20731
0 qom0aduzjbdzo3ljkfd8awjeuascocnjkis8ae0vkqm6z6 go2w1xowuvxddw5vabdu3odtwvgmc

Hi I tried doing the steps you have suggested. But after i choose recovery mode,my machine goes to the screen which says loading disk and its stuck there.Please help.I tried doing it multile times,but in vain.

over 1 year ago ·
28598

well, you're still required to enter the root password. :P bummer! http://i.imgur.com/wdDSOiJ.png

9 months ago ·
29072

Remember that you need to have your vm capture your mouse first in order for Shift to get you into Grub. http://makezine.com/2008/09/03/howto-reset-a-lost-ubuntu-pass/

5 months ago ·
29097

When your machine is powered on, press ESC to access the recovery mode. You can then use the "passwd" command to reset your ubuntu password. https://www.top-password.com/blog/how-to-reset-forgotten-ubuntu-password/

5 months ago ·
Filed Under