Alternate method to reset Linux password.

Step 1: From the Grub menu press “e” to edit commands before booting.

Unedited grub commands

Step 2: In the line starting with linux, edit ro to rw and append init=/bin/bash at the end of that line.

Edited grub commands

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

Commands to reset password

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.

Similar Reads

Reset password using recovery mode.

Step 1: During startup, from the Grub menu select “Advanced options for Ubuntu”....

Alternate method to reset Linux password.

Step 1: From the Grub menu press “e” to edit commands before booting....

Conclusion

in this article we discussed that how to reset a lost password in a Linux distribution, primarily Ubuntu 23.04 but applicable to other versions and distributions. It offers two methods: one via recovery mode and an alternative through editing boot commands. The concise, step-by-step instructions are accessible to all users and emphasize password security. This article serves as a valuable resource for those locked out of their Linux systems, ensuring they can regain access quickly and securely....