How to recover my forgotten user password in Ubuntu

It happens to everyone that at some point they forget the password to log in to their computer. No matter how hard you try different combinations of numbers and letters, you can’t find the right one. Don’t worry, here is how to recover your forgotten user password in Ubuntu from terminal.

Discover effective methods to recover your forgotten user password in Ubuntu. Learn how to regain access to your system without losing any data.

This type of case is more common than it seems, and it happens to all of them at some point in their life. As much as you want to remember it, the password just doesn’t appear in your head. This can be a big problem. However, it has a solution and is simpler than it seems, since free software will help you in every step (Linux is so good that you can even recover the Windows password from it, and they are theoretical rivals).

Recovering a forgotten user password in Ubuntu can be done by following these steps. This guide is presented in a tabular format for clarity:

Step Action
1 Restart your computer and open GRUB menu: As your computer starts, hold down the Shift key (if you have a single boot) or press Esc key (if you have a dual boot) to access the GRUB boot menu.
2 Select Recovery Mode: In the GRUB menu, choose the ‘Advanced options for Ubuntu’ and then select the ‘Recovery Mode’ (usually the second line with ‘(recovery mode)’).
3 Access Root Shell Prompt: Once in recovery mode, scroll down using the arrow keys and select ‘Root Drop to root shell prompt’.
4 Remount File System with Write Permissions: At the root shell prompt, type mount -rw -o remount / to remount the filesystem with write permissions.
5 Reset Password: Use the passwd command followed by the username of the account whose password you want to reset. For example, passwd username. You’ll then be prompted to enter a new password.
6 Apply Changes and Reboot: After resetting the password, type exit to leave the shell and then continue with the normal boot process by selecting ‘Resume normal boot’ or by simply rebooting your computer.

Important Notes:

  • Be careful when operating as a root user, as you have full access to system files.
  • The method might vary slightly depending on the Ubuntu version.
  • If your system uses full disk encryption, this method might not work.

Recover user password with administrator password

One of the fastest options to recover your forgotten user password in Ubuntu is through the administrator password.

If you share your computer with another person, and they have administrator rights, you can quickly recover your password. You just have to write the following in the terminal:

You must start by typing “~ $ sudo passwd tuusuario” and press the “Enter” key. Then you enter “Enter new UNIX password” . After executing it, you must append “Retype new UNIX password” and again, execute. To finish you write in the terminal “passwd: password updated successfully” . And voila, you can now reset your user password.

This is the fastest way to recover your password. However, what if you don’t have access to the administrator? That’s where things get a bit complicated.

But more complicated does not mean impossible. So here you have another option to recover your forgotten user password in Ubuntu from terminal.

Recover your forgotten user password in Ubuntu from terminal

The first thing you should do is restart your computer and press the ” Esc .” Key . As soon as the GRUB menu is displayed, you must go to the “Recovey Mode” section but without pressing the ” Enter ” key .

When you are on the option “Recovery Mode” you must press the ” E ” key on your keyboard. This will allow you to edit the boot options. When you are in the boot options window you should locate the following address: “Linux /boot/vmlinuz-3.2.0-18-generic root = UUID = b8b64ed1-ae94-43c6-92 \ d2-a19dfd9a727e ro recovery nomodeset:”.

You must select it and replace “Recovey nomodeset” with the following: “rw init = / bin / bash:”. This will change the way your computer starts up. This will power up into recovery mode and the command line will appear.

Then you must press the F10 key in order to load the changes and reboot the system. If you have done everything correctly, a black screen should appear where you must type the following command: “/ usr / sbin / usermod -p ‘ourpasswordswithout quotes’ ‘ourusernamewithout quotes’.

Retrieve username

If you have also forgotten your username, you can find out with the ” lastb ” command . What this will do is check who was the last user to try to enter the system.

Another way to do it is looking for a list of all users on the system thanks to the following command: “cat / etc / passwd | cut -d »:» -f1 ”.

It may be necessary to change the password of the root user or the one who has more privileges on the system. For this you must execute the command: “usr / sbin / usermod -p ‘our password without quotes’ root”.

To finish the process of recovering your forgotten user password in Ubuntu from the terminal, you just have to restart the PC and wait for it to turn on again. The next thing is to enter the username and password normally in order to access your session.

It may seem like a somewhat complicated process, but it really is not. You just have to correctly follow each step of the tutorial and append the commands as indicated. In this way you will be able to access your session again and recover all your files.

Remember that in addition to recovering your username, you can also change the forgotten root password in case you have also lost that one. And to complement the use of the terminal, it is recommended that you look for more commands such as the one that allows you to rename files in Linux , or the one that lets you hide files and folders in Ubuntu .

 

by Abdullah Sam
I’m a teacher, researcher and writer. I write about study subjects to improve the learning of college and university students. I write top Quality study notes Mostly, Tech, Games, Education, And Solutions/Tips and Tricks. I am a person who helps students to acquire knowledge, competence or virtue.

Leave a Comment