How to reset your Ubuntu password when you are running in Virtualbox.
The Ubuntu distribution works quite well in Virtualbox, but sometimes you can forget the password for the user you created and you need to reset the password. This is very easy.
- Firstly; boot your Virtualbox instance.
- Then hold the shift key to get the GRUB menu.
- Select the recovery mode option.
- Choose to drop to a root shell prompt.
Just type these commands after loading the rescue mode and you can re-set the password.
Remount the / partition in read-write mode. Use the mount command to achieve this.
~# mount -rw -o remount /
Then use the passwd command to reset your Ubuntu password.
~# passwd <USERNAME>
Where <USERNAME> is the username you have created on installation.
This will reset your Ubuntu password. I had an error with setting the Ubuntu password in single user mode, this mounts / in read-only mode. so you need to use the remount command to enable you to write to the /etc/passwd file.