Resetting password in Ubuntu

If you have forgotten the user (or root) password on an Ubuntu system, follow these steps and you will be able to login and start using the machine again.

When the machine is booting, keep the Shift key pressed; this will invoke the Grub menu.

The menu will look something like this.

Related image

Select the Advanced mode and Select the recovery mode from the shown menu. (In some cases you may be able to select the recovery mode menu from the above menu itself).

enter image description here

In the recovery menu, select the root option.

The command prompt will now be shown.

The file system is not available for Write now. It has to be mounted with RW permissions. As the user/password information is stored in the file system and we are updating the same, we will need to have the Read Write permissions. Execute the following command.

mount -rw -o remount /

Now you can execute the passwd command to change the password.

passwd <username>

You will be prompted for the new password.

If you want to create a new user, before executing the passwd command, use the useradd command to create the new user and update the password using passwd command.

If everything went fine, you will be able to restart the machine and login with the new password.

Suresh Kumar Neti has written 7 articles

Has over 26 years of experience in various roles in software industry. As the Founder and CEO of Neti Software Services, loves finding solutions to problems faced by the customers.

Leave a Reply

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

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <s> <strike> <strong>