Resetting password in an Ubuntu virtual machine

177 users found this article helpful

To reset a password in an Ubuntu virtual machine perform the following steps:

  1. Go to virtual machine's Configuration > Hardware > Boot Order.
  2. Tick Select boot device on startup
  3. Run Ubuntu
  4. Once the virtual machine start to boot, make sure that the virtual machine is active (click inside virtual machine window) and press Shift key repeatedly (it your virtual machine uses UEFI press the Esc key instead) until you see the grub menu. 
  5. From the boot menu, select recovery mode, which is usually the second boot option
    alttext
  6. After you select recovery mode and wait for all the boot-up processes to finish, you'll be presented with a few options. Navigate to the Drop to root shell prompt using the arrow keys and press Enter.

    <p><img alt="alttext" src="http://kb.parallels.com/Attachments/kcs-34521/fixsudoprecise03.jpg" title="title" /></p>
    
    <p>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.</p>
    
    <p>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:</p>
    
    <pre>
    

    mount -o rw,remount /

  7. If you have forgotten your username as well, type:

    <pre>
    

    ls /home

  8. To reset the password, type:

    <pre>
    

    passwd username

    <p>Where username is the username you want to reset.</p>
    </li>
    <li>
    <p>You&#39;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&#39;re done. You&#39;ll be prompted to retype the password. Do so and hit <strong>Enter</strong> again.</p>
    </li>
    <li>
    <p>Now the password should be reset. Type</p>
    
    <pre>
    

    exit

    <p>to return to the recovery menu.</p>
    </li>
    <li>After you get back to the recovery menu, select <strong>resume normal boot</strong>, and use Ubuntu as you normally would.
    

Was this article helpful?

Tell us how we can improve it.