Forgot your vm password?

I run a couple of virtual machines on my work laptop and a couple more on my personal laptop. I didn’t open one of them for quite sometime and naturally forgot the password (reminder to keep easy/handy ones!).

I use Ubuntu vms created using virtual box. Here is what worked for me to reset vm password:

  •  Right after you boot your vm, hold on the Shift key, let it load the grub menu
  •  Select Ubuntu Recover mode option
  •  Scroll down and click ‘drop to root shell prompt’

At this point you could change your password by doing:

passwd {username}

If it threw the below error:

passwd: Authentication token manipulation error
passwd: password unchanged

It means, the filesytem is mounted in ready-only mode and hence is preventing from changing password. Make it read-write by running this:

mount -rw -o remount /

Resetting password with this should now work: passwd {username}