How to reset user password in Ubuntu VM3 min read

Preface

If you are using an Ubuntu VM, it happens that you forget the password to log into the VM. The good thing is, you don’t have to re-install the VM. You can reset the user password so that you can log in again to the Ubuntu VM. This article will guide you to do the same.

Using a VM allows you to use the different OS on the same system without dual boot. You just need a Virtual Environment such as Oracle VirtualBox or VMware and an image of the OS you want to work on. In this article, we will be looking at the Ubuntu VM. You can download the Ubuntu Virtual Machine image from osboxes.

Note: If you have downloaded a VDI file of the Ubuntu VM, then you can follow our article on How to import VDI in Oracle VirtualBox.

Now without wasting any further time, let us go through the steps to reset the password. Note that the steps provided below are to reset user password and not root password.

Reset user password in Ubuntu VM

1. Start the VM and press Shift before the VM completely boots (as soon as you start the VM, a black screen will appear, you need to press Shift key here). You should see a screen like below,

ubuntu vm start

2. Select Advanced options for Ubuntu and press Enter

advanced options for ubuntu

3. Select Recovery mode

recovery mode

You should see a screen like below,

recovery menu to reset user password in ubuntu vm

4. Go down to root option and press Enter key press Enter again

root shell to reset user password in ubuntu vm

5. Execute the below command now to remount the root partition with write access. By-default, it has read-only access.

mount -rw -o remount /

6. Now you can reset your password with the below command,

passwd user

Provide a new password here.

7. Execute the below command now for the changes to take effect and to restart the VM,

reboot

8. Provide the new password while logging in.

Done. We have successfully reset the user password.


Share:

Leave a Reply