+5 votes
115 views
in Linux by (242k points)
reopened
forgot Ubuntu password - what to do?

1 Answer

+3 votes
by (1.6m points)
 
Best answer

Start recovery mode
1st step:
2nd step:
3rd step:
4th step:
5th step:
6th step:
Change root password
1st step:
2nd step:
3rd step:
Delete user password
1st step:
2nd step:
3rd step:
4th step:
5th step:
6th step:
7th step:
Brief instructions: Start recovery mode
Quick guide: changing the root password
Brief instructions: Delete user password

Forgot your Ubuntu password? We'll show you how you can still get your data back..

image image

Forgotten passwords are always annoying - especially when it comes to your own computer password. You can no longer access your important data. We'll show you two ways in which you might still be able to regain access to your Ubuntu computer.

Warning: If you have already protected your GRUB menu , these instructions will no longer work unless you know the root password. In this case you can only use the instructions for deleting the user password. If your menu is protected and you cannot remember either password, you cannot recover your password. This means that you no longer have any way of accessing your saved data.

Start recovery mode

The only way to recover your password under Ubuntu is via the recovery mode or via the so-called GRUB menu. Follow our step-by-step instructions or take a look at the brief instructions ..

1st step:

image
While your PC is starting up, you have to press the [Esc] key . With some computers or virtual machines, you may have to hold Shift instead. " GRUB loading, please wait ... " is displayed on some devices, and nothing at all on others. Press the [Esc] key at the right time to open the GRUB menu. From here you can navigate with the arrow keys. Highlight " Advanced Options for Ubuntu " and press [Enter] .

2nd step:

image
Select the recovery mode of the latest version. If you have multiple versions available, the most recent version is always higher up. Press [Enter] to confirm .

3rd step:

image
Use the arrow keys to navigate to " root " and press [Enter] .

4th step:

image
Press [Enter] again to enter the code.

5th step:

image
Now enter the command cat / etc / shadow and press [Enter] . Pay attention to the space between "cat" and "/ etc".

6th step:

image
You will now see a lot of code here. At the very bottom you can see the names of the user accounts. This is especially helpful if you are no longer sure about the correct spelling of the username. Now decide whether you want to change the root password or delete the password from a user . No matter which method you choose: You will then have access to your data stored under Ubuntu again.

Change root password

If you want to change the root password, you have to choose this method. Follow our step-by-step instructions or take a look at the brief instructions .

1st step:

image
Enter the code " passwd [username] " (without quotation marks). Then press [Enter]. Now enter the same root password twice and confirm each entry with [Enter] . The password is not displayed for security reasons.

2nd step:

image
Complete the entry with " Exit " and [Enter] . Then use the arrow keys to select " resume ". Press the [Enter] key .

3rd step:

image
To confirm, press [Enter] again to start up the PC and the operating system.

Delete user password

If you only want to access a specific user account and have forgotten its password, this method is ideal. Follow our step-by-step instructions or take a look at the brief instructions ..

1st step:

image
Type in the following code: " mount -o remount, rw / " (without the quotes). Also, pay attention to the spaces. Then press [Enter] .

2nd step:

image
Enter the code " nano / etc / shadow " (without the quotation marks). Note the space between "nano" and "/ etc". Confirm with [Enter] .

3rd step:

image
The nano editor opens. The user names and a long sequence of characters are displayed in the bottom lines . These are shown in the following form: [Username]: Code: 17788: 0: 99999: 7 ::: The code is your encrypted password. The number after it says how many days have passed since the password was last changed (in relation to 1/1/1970). The 0 describes that you can change the password at any time. The number 99999 thereafter describes the days in which the password must next be changed. And the number 7 means that the user will be informed about this one week before the password expires. Tip : To jump directly to the last line of the Nano-Editor , first press [Ctrl] + [W] and then [Ctrl] + [V] .

4th step:

image
Remove the code part. Then the display should look something like this: [Username] :: 17788: 0: 99999: 7 ::: .

5th step:

image
Press the key combination [Ctrl] + [X] to quit the input. Confirm the exit with [Y] (in the English version) or [J] (in the German version ).

6th step:

image
You are now back in the recovery menu. Select " resume " and confirm with [Enter] .

7th step:

image
Now press [Enter] again to confirm . Your PC and your Ubuntu operating system will now start up normally. For security reasons you have to assign a new password for your user. Look for " User " in System Preferences . There you can set a new password for this user by clicking on the password field.

Brief instructions: Start recovery mode

  1. Immediately after your PC has started up, press the [Esc] key. With some computers or virtual machines, you may have to hold Shift instead. On some devices, the command line " GRUB loading, please wait ... " is displayed. If this is the case with your device, you must press the [Esc] key at this point. How to open the GRUB menu.
  2. Now use the arrow keys to select " Advanced options for Ubuntu " and confirm with the [Enter] key .
  3. Now select the recovery mode of the latest version and press the [Enter] key . The latest version can be recognized by the version number, for example 4.15.0-29-generic (recovery mode) . If more 4.15.0-32-generic (recovery mode) than one version number is available, take the larger one: The number would be newer than the number mentioned above. As a rule, the latest version is always at the top.
  4. Use the arrow keys to select " root " and press [Enter] twice .
  5. Enter the following code: cat /etc/shadow and press [Enter] . Note the space between " cat " and the rest of " / etc ... ".
  6. You will now be presented with a ton of code. You can see your username in the bottom line . This will help when you are unsure how to write this.
  7. Now you can decide whether you want to change the root password or delete the password of a user account . You can then use either method to access your data stored under Ubuntu again.

Quick guide: changing the root password

  1. Enter " passwd [Nutzername] ". Of course, without quotation marks and for [Nutzername] , you enter your username .
  2. Now you have to enter a new root password twice and confirm each time with [Enter] .
    Don't be surprised if the password is not displayed. This is a security measure. Just enter the password you want to set and press [Enter] .
  3. Now enter " Exit " and select " resume " with the arrow keys and confirm with [Enter] .
  4. Press [Enter] again to start your computer normally.

Brief instructions: Delete user password

  1. Enter mount -o remount,rw / . Pay attention to the correct setting of spaces. Confirm your entry with [Enter] .
  2. Now type in the code nano /etc/shadow . Pay attention to the space in front of " / etc ". Press the [Enter] key .
  3. You will now see a lot of text. Scroll to the very bottom. A very long line of code will now appear behind your username, which looks something like this: The code is your encrypted password.
    [Nutzername]:Code:17788:0:99999:7:::
  4. Simply delete the code part so that only [Nutzername]::17788:0:99999:7::: appears.
  5. Now press [Ctrl] + [X] to quit the entry. Confirm the changes with [Y] (if the output is in English ) or with [J] (if the output is in German).
  6. In the recovery menu you now have to select " resume " and then press [Enter] twice to start your PC and Linux-Ubuntu normally.
  7. For security reasons you now have to set a new password . You can do this in the system settings under "User". If you do not do this, Ubuntu may only function to a limited extent in some areas.

...