How to Reset Password in Virtual Machine on Virtualbox

  • Mac

Virtual machines are a great way to run multiple operating systems on a single computer, but it can be challenging to manage the passwords on those virtual machines. Whether you’re running a virtual machine for a server or just experimenting with different operating systems, you’ll need to know how to reset passwords in case you get locked out. If you’re using Virtualbox as your virtual machine software, then you’re in luck! In this blog post, we’ll show you how to easily reset passwords on your virtual machines.

Video Tutorial:

The Challenge of resetting password in Virtual Machine on Virtualbox

Resetting passwords on virtual machines can be tricky because you typically can’t just boot into safe mode or use other traditional methods. Virtual machines are, after all, just a virtual environment running on top of your primary operating system. This means you’ll need to find a way to get access to the virtual machine’s filesystem so you can reset the password.

Things You Need to Prepare

Before we dive into the methods, here are a few things you’ll need to prepare:

  • Access to the internet to download a bootable ISO image
  • A virtual machine running on Virtualbox
  • A virtual CD/DVD drive attached to your virtual machine
  • A tool for mounting ISO files, such as WinCDEmu
  • A basic understanding of the command line

Method 1: Reset Password using an Ubuntu Live CD

Using an Ubuntu live CD is one of the easiest ways to reset a password on a virtual machine running on Virtualbox. Here are the steps:

1. Download the latest version of Ubuntu from the official website and save it as an ISO file.

Link to the official website: http://www.ubuntu.com/download/desktop
2. Open Virtualbox and select the virtual machine you want to reset the password for.
3. Click on "Settings" and then "Storage".
4. Click on the CD icon under "Controller: IDE" and select "Choose Virtual Optical Disk File".
5. Navigate to the Ubuntu ISO file you downloaded and select it.
6. Click on "OK" to close the "Settings" window.
7. Start the virtual machine and press F12 to boot from the CD/DVD drive.
8. Select the "Try Ubuntu without installing" option.
9. Once Ubuntu is loaded, open the terminal and type the following commands:

sudo fdisk -l

10. Find the partition that contains the operating system that you want to reset the password for. It should be labeled something like "/dev/sda1".
11. Mount the partition using the following command:

sudo mount /dev/sda1 /mnt

12. Change the root directory to the mounted partition:

sudo chroot /mnt

13. Reset the password by typing the following command and following the on-screen instructions:

passwd username

14. Exit the chroot environment by typing the following command:

exit

15. Reboot the virtual machine and log in with your new password.

Method 2: Reset Password using System Rescue CD

System Rescue CD is a Linux distribution designed for repairing systems and data rescue tasks. You can use it to reset the password on a virtual machine running on Virtualbox. Here are the steps:

1. Download System Rescue CD from the official website and save it as an ISO file.

Link to the official website: https://www.system-rescue.org/Download
2. Open Virtualbox and select the virtual machine you want to reset the password for.
3. Click on "Settings" and then "Storage".
4. Click on the CD icon under "Controller: IDE" and select "Choose Virtual Optical Disk File".
5. Navigate to the System Rescue CD ISO file you downloaded and select it.
6. Click on "OK" to close the "Settings" window.
7. Start the virtual machine and press F12 to boot from the CD/DVD drive.
8. Select the "Default Boot" option.
9. Once System Rescue CD is loaded, open the terminal and type the following commands:

fdisk -l

10. Find the partition that contains the operating system that you want to reset the password for. It should be labeled something like "/dev/sda1".
11. Mount the partition using the following command:

mount /dev/sda1 /mnt

12. Change the root directory to the mounted partition:

arch-chroot /mnt

13. Reset the password by typing the following command and following the on-screen instructions:

passwd username

14. Exit the chroot environment by typing the following command:

exit

15. Reboot the virtual machine and log in with your new password.

Method 3: Reset Password using Hiren’s Boot CD

Hiren’s Boot CD is a great tool for resetting passwords on virtual machines running on Virtualbox. Here are the steps:

1. Download Hiren’s Boot CD from a reliable website and save it as an ISO file.

Link to a website: https://hirensbootcd.org/hirens-bootcd-download/
2. Open Virtualbox and select the virtual machine you want to reset the password for.
3. Click on "Settings" and then "Storage".
4. Click on the CD icon under "Controller: IDE" and select "Choose Virtual Optical Disk File".
5. Navigate to the Hiren’s Boot CD ISO file you downloaded and select it.
6. Click on "OK" to close the "Settings" window.
7. Start the virtual machine and press F12 to boot from the CD/DVD drive.
8. Select the "Mini Windows XP" option.
9. Once Mini Windows XP is loaded, open the "HBCD Menu" and navigate to "Passwords/Keys" > "Windows Login" > "Offline NT/2000/XP/Vista/7 Password Changer".
10. Follow the on-screen instructions to reset the password for the user account you want to modify.
11. Exit Hiren’s Boot CD and reboot the virtual machine.
12. Log in with your new password.

Why Can’t I Reset the Password using Traditional Methods?

1. Safe mode won’t work: Virtual machines don’t have a physical BIOS, which means you can’t press F8 to boot in safe mode like you would on a physical machine.
2. No physical access: You can’t reset the password by booting from a Windows installation media because virtual machines don’t have physical optical drives. You also can’t use a USB drive to reset the password unless the virtual machine has USB support enabled.
3. Encryption: Some virtual machines have encryption enabled, which means you can’t just mount the virtual machine’s hard drive on the host operating system and reset the password using traditional methods.

FAQs

Q: Can I use these methods to reset the password on a physical machine?

A: No, these methods are only applicable for virtual machines running on Virtualbox.

Q: Why do I need to mount the partition before resetting the password?

A: Mounting the partition gives you access to the virtual machine’s file system, which allows you to reset the password.

Q: What do I do if I can’t find the partition that contains the operating system I want to reset the password for?

A: You may need to try a different method, or you can seek assistance from a technical support specialist.

Q: Can I reset the password for the administrator account?

A: Yes, you can reset the password for any user account on the virtual machine.

Q: What should I do if I forget my new password?

A: Use one of the methods outlined in this blog post to reset the password again.

Conclusion

Resetting passwords on virtual machines can be challenging, but it’s a necessary skill for anyone who uses virtualization software. Using the methods outlined in this blog post, you’ll be able to easily reset passwords on virtual machines running on Virtualbox. Remember to always keep your passwords safe and secure, and never share them with anyone.