In this article, we will learn how to reset lost administrative password on Ubuntu. Yes if you are forging the root or admin password in Ubuntu. Because we can change the password only when we login into Ubuntu. but if we cannot log in, we can not change the password. so let’s start.
What you’ll learn
- How to reset the password on Ubuntu.
- How to reset any user’s password.
What you’ll need
- Ubuntu Desktop
- Basic Linux command line knowledge
Reset the User’s Password in Ubuntu
You can reset an Ubuntu password very easily. This tutorial explains an easy method for changing the root password on Ubuntu. The method should also be applicable to other Debian-based distributions.
Boot into recovery mode
Switch the computer on. Go to the grub menu. Generally, it appears automatically, but if not, then hold down the Shift key or press the Esc key until the boot menu appears.
If you’re using VMware or VirtualBox, you have to hold down the Shift key and you will get the grub menu.
In the grub menu, press the “E” key to edit the grub screen.
Edit the grub file
Find the line starting with linux, change the ro to rw and append init=/bin/bash at the end of that line.
Press ctrl-x or F10 to save your changes and boot.
Now you are booting into the command line interface Linux kernel with read and write permissions, you’ll use the bash shell.
Reset the root password
In other words, your system will boot up to a passwordless root shell. Now here you can change the user’s password.
# passwd username
Type in the passwd command with your username. If you don’t know the username, check with the ls /home command
Reboot the Ubuntu
Once you’ve set the new password, just type the following command in the terminal to reboot your system in normal mode.
# exec /sbin/init
Your password should be changed now.
Conclusion
This is the way how to reset the forgotten user’s password in Ubuntu 22.04. I hope I made things clear about resetting forgotten passwords in Ubuntu.
If you have any questions, feel free to leave a comment.
Related Posts: