How to change forgotten root password in Linux VM

This has happened few times for me in the past and this guide will provide all the steps that is required to recover the root password.


  1. I assume you own the server whose root password you are trying to recover.
  2. You are not hacking into a system that you do not “own”
  3. I bear no responsibilities on the damages caused.

Steps to Recover

  1. Assuming you have a boot drive e.g. USB stick or DVD drive, burn a Live ISO can be any flavor, Fedora or Ubuntu or Knoppix.
  2. Boot into the Live OS by changing the BIOS boot to start from USB or DVD
  3. When the live OS has launched sucessfully, open the “Terminal” window
  4. Run the following command to mount the hard drive
    1. $ sudo mount /dev/sda1 /media/sda1
  5. Edit the file /media/sda1/etc/shadow
    1. Delete the long string after root: until next “:”
  6. Reboot Linux VM
  7. Login console, use root and blank password

0 Comments on How to change forgotten root password in Linux VM

Leave a Comment

Your email address will not be published. Required fields are marked *

You Might Be Interested In