How to Recover Ubuntu Password

Last update: 04/10/2024
How to Recover Ubuntu Password

Do you want to know how Recover Ubuntu PasswordIf you forgot your user password on Ubuntu, don't worry. You can reset an Ubuntu password very easily. This guide will explain the easy methods to change the password of your Ubuntu user. root on Ubuntu. The method should also be applicable to other distributions Linux.

Forgot your Ubuntu login password?

If you haven't used Ubuntu for some time, it's natural that you don't remember the password. The good news is that you don't need to reinstall the entire operating system because of this. You can easily recover Ubuntu password.

These methods mentioned here work to reset an Ubuntu password on VMware, Boot dual or single installation. All you need is a little patience and run a couple of commands. You will reset the root password in minutes.

Here you can read about: How to install and configure a Squid proxy server on Ubuntu

Reset or recover Ubuntu password from recovery mode

Now, let’s see the steps to perform Ubuntu password recovery.

Part 1: Use boot into reset mode to recover Ubuntu password

  • Step 1:: Turn on the computer. Go to the grub menuIt usually appears automatically, if you can't find it, hold down the shift keypress the Esc key until the boot menu appears.
  • Step 2:: If you are using Oracle infrastructures VirtualBox or VMware, You hold down the shift keywhen the Oracle logo appears or VMware.
  • Step 3:: In the grub menu, select «Advanced options for Ubuntu«:
This is the grub screen
This is the grub screen

NOTE: : Here, you will see the option to go to recovery mode:

This is the grub screen

It will take you to a black screen with several lines of output displayed in an instant. Wait a few seconds here.

Part 2: Drop into root shell prompt to recover Ubuntu password

  • Step 1:: Now you will be presented with different options for the recovery mode. Here you need to choose » Root – Drop to root shell prompt«. Simply press the Enter key to select this option. As in the following image:
Root - Drop to root shell prompt
Root – Drop to root shell prompt

You will see that when you select the root shell prompt option, an option to enter commands appears at the bottom. This is your root shell prompt and this is where you will use the commands to reset the password.

Part 3: Remount root with write access to recover Ubuntu password

You need to have write access to the root partition. By default, you have read-only access. Use the following command to remount it with write access:

  • mount -rw -o remount /

Part 4: Reset your username or password

  • Step 1:: Here, you will be given root access. Use the following command to list all available users:
    • ls/man
  • Step 2:: Based on this command, choose the » Username» for which you want to reset or (say) hack the password. Now, use the following command to reset the password of the » Username » selected :
    • username passwd
  • Step 3:: Request a new password. Enter the new password twice:
    • Enter the new password for UNIX:
    • Re-enter the new UNIX password:
  How to use tags and filters in Evernote to organize your notes

NOTE: : There you go. You have just recovered your Ubuntu password. Now exit the root shell prompt by typing: Exit

  • Step 4:: When you exit, you will be returned to the recovery mode menu. Select the normal boot option here.

How to Recover Ubuntu Password

NOTE: : There will be a warning about graphical mode compatibility. Don't worry. A hard reset will fix any issues with this. You should now be able to log in with the new password.

Possible troubleshooting when recovering Ubuntu password:

When entering the new password, you may be prompted for a authentication token handling error like this:

  • Username passwd
  • Enter the new UNIX password:
  • Re-enter the new UNIX password:
  • passwd: authentication token handling error
  • passwd: unchanged password

The reason for this error is that the file system is mounted with read-only access. Change the access and remount the file system as follows:

  • mount -rw -o return to mount /

Now try resetting your Ubuntu password again. It should work now. As you can see, it is extremely easy to recover your Ubuntu password even if you have forgotten it. It will take you just a few minutes.

Alternative method to reset Ubuntu password

If for some reason you are having difficulty accessing the root shell and changing the password, you can try these steps.

  • Step 1:: Restart your computer. Hold down the key Shift to bring up the grub screen (if it doesn't appear automatically). Press E at the grub prompt to edit the grub screen.
  • Step 2:: Find the line that starts with linux, change ro to rw and add init=/bin/bash at the end of that line.
Change ro to rw and add init=/bin/bash at the end of this line
Change ro to rw and add init=/bin/bash at the end of this line
  • Step 3:: Press CTRL-X to save your changes and boot.

NOTE: : You are now booting into the Linux kernel with read and write permissions, and instead of going to a graphical user interface, you will use the bash shell. In other words, your system will boot into a root shell with no password.

  • Step 4:: Type the command Passwdwith your username. If you don't know the username, check with the ls /home command (as mentioned in part 1).
  • Step 5:: Set your new password. Once you have set the new password, log out of the terminal. Just write Reiniciarin the terminal or use the shutdown command:
    • shutdown -r now

Your password should now be changed.

If it's so easy to recover Ubuntu password, isn't this a security risk?

That's a fair question. One of the main advantages of Linux over Windows is your security. But if “anyone” can reset your password, how can Ubuntu or other Linux distributions be considered secure?

Let us explain a few things here. The main security risk is if someone hacks your account from a remote location over the internet. That's not happening here.

If someone has physical access to your computer, the data on your computer is already at risk. Unless the entire disk is encrypted, anyone can “steal” your data using a USB live without even entering your installed operating system.

  Top 5 Programs to Highlight PDF

By default, Ubuntu does not have a root password and the root account is locked. The user account you set up when installing Ubuntu is listed as an administrator with sudo rights. But that does not mean you are root.

This lack of a root password is a deliberate feature. The «Advanced Options for Ubuntu» in the boot menu allow you to perform some specific root-related tasks from the «root shell prompt«. That is why you can reset Ubuntu password through this method.

If you want to make your system more secure, you can encrypt the disk (to save your data) or set a password for the root user in Ubuntu.

Bonus Tip: Handling a potential keychain issue after changing your password

There is a keychain feature in Ubuntu which is used to keep passwords locked and safe. When you reset the forgotten password, the keychain remains unlocked and you may see an error message like this.

Change ro to rw and add init=/bin/bash at the end of this line

  • Step 1:: Open the app Passwords and keys and here, remove login passwords.
Delete Ubuntu Keychain
Delete Ubuntu Keychain

When you try to use Google Chrome Again on Ubuntu, it will ask you to create a new keyring. Use the new login password as the keyring password.

Another way to recover Ubuntu password if you forget it

It is important to choose a good password that is secure, but also easy to remember. If you have forgotten the password you use to log into your user account, you can use the following steps to recover your Ubuntu password.

  • NOTE: : If your home directory is encrypted, you will not be able to reset a forgotten password.

Recover Ubuntu Password Using Grub

  • Step 1:: Restart your computer and hold down the key May during startup to access the Grub menu.

NOTE: : If you have a dual boot machine and you choose the system you want to boot, the Grub menu should appear without pressing MayIf you are unable to enter the GRUB boot menu and therefore cannot choose to boot into recovery mode, you can use a live CD to recover your Ubuntu password.

  • Step 2:: Press the down arrow on your keyboard to select the line that ends with the words "recovery mode» and then press Enter.
  • Step 3:: Computer will now begin the boot process. After a few moments, a recovery menu will appear. Use the down arrow key to highlight Root and press Enter.
  • Step 4:: In the symbol #, enter: passwd usernameWhere usernameis the name of the account whose password you are changing.
  • Step 5:: You will be prompted to enter a new UNIX password and confirm the new password.
  • Step 6:: Then write: # reboot

After you successfully log in, you will not be able to access your keychain (as it cannot remember the old password). This means that all your saved passwords for wireless networks, Jabber accounts, etc. will no longer be accessible. You will need to delete the old keychain and start a new one.

Recover Ubuntu Password Using Live CD or USB

  • Step 1:: Boot the Live CD or USB.
  • Step 2:: Build your record.
  • Step 3:: Press the key combination Alt+F2to show the window Run command.
  • Step 4:: Type gksu nautilus to start the file manager with system-wide privileges.
  How to embed your Twitter account on your Instagram profile? - Synchronize networks

NOTE: : From the partition you mounted, you can verify that it is the correct partition by clicking home and then clicking your username.

  • Step 5:: Go to the top-level directory of the mounted partition. Next, go to the etc directory.
  • Step 6:: Find the “shadow” file and make a backup:
    • Step 6.1:: Right click on the shadow file and choose Copy.
    • Step 6.2:: Then right click on an empty space and select Take.
    • Step 6.3:: Rename the backup to «shadowback«.
  • Step 7: Edit the file «shadow» original with a text editor.
  • Step 8: Find your username for which you forgot the password. It should look like this (the characters after the colon will be different):
    • user: $1$2abCd0E or
    • user:$1$2abCd0E:13721a:0:99999:7:::
  • Step 9:: Remove the characters after the first “:” and before the second “:”. This will remove the account password.

NOTE: : Save the file, exit everything and restart your computer without the Live CD or USB.

  • Step 10:: When you reboot, click on your name in the menu bar. Open My account and reset your password.
  • Step 11:: For the current password you do not enter anything, since your current password is empty. Simply click on Authenticateand enter a new password.

NOTE: : After you successfully log in, you will not be able to access your keychain (since you cannot remember the old password). This means that all your saved passwords for wireless networks, Jabber accounts, etc. will no longer be accessible. You will need to delete the old keychain and start a new one.

Get rid of all Ubuntu passwords

This will delete all your saved passwords for wireless networks, instant messaging accounts, etc. Only do this if you can't remember the password you used for your keychain.

  • Step 1:: Go to your personal folder by entering «Home» on the board.
  • Step 2:: Press Ctrl+h(or click on View   Show hidden files).
  • Step 3:: Double click on the ~/.local/share folder.
  • Step 4:: Double-click the folder called keychains.
  • Step 5:: Delete everything you find in the keychains folder.
  • Step 6:: Restart the computer.

After rebooting and logging in, you will be prompted for your wireless network connection password.

You may also like: What Is Lubuntu? Uses, Features, Opinions, Prices

Conclusion

As you can see, these are the ways on how to recover Ubuntu password. There are other more in-depth methods, but these are the simplest ones you can use. We recommend that you follow each instruction step by step. We hope we have helped you with this information.