Alternate method to reset Linux password.
Step 1: From the Grub menu press “e” to edit commands before booting.
Step 2: In the line starting with linux, edit ro to rw and append init=/bin/bash at the end of that line.
Step 3: Press Ctrl+X to boot into the root shell.
Step 4 :Next, proceed by entering the following commands to reset the password.
- If you don’t know your username, use the following command to list all users.
ls /home
- Now to reset the password execute “passwd username”, your username should replace the username.
passwd username
- Enter a new password and retype the new password to confirm it (Note: Linux does not display the password you typed, just type and press Enter).
New password:
Retype new password:
passwd: password updated successfully
- Now you have successfully changed your password. Execute the following command to restart the system.
/sbin/reboot -f
Now you can use the system with a new password.
How to Reset a Lost Password in Ubuntu and Other Linux Distributions
This article explains how to reset lost a password in a Linux distribution. If you have forgotten your Linux password, this article is undoubtedly for You. This guide uses Ubuntu 23.04, but the same method applies to other versions of Ubuntu and other Linux distributions.