Sometimes it happens that you cannot remember the password of the Ubuntu user and for this reason cannot log into the computer. There are actually at least two ways to reset your Ubuntu password, both as a regular user and as a root user.
Necessary
Installed Ubuntu OS
Instructions
Step 1
The first method will work in most cases when the root user password is not set. If, after installing the Ubuntu operating system, you did not set a special password for the root user, then this user is disabled and he does not have a password. If you changed your password, then go to the second method, which is described below (step 5). So, restart your computer.
Step 2
After BIOS self-diagnostics, you should see the Ubuntu boot menu, which looks like the one in the picture. If this did not happen, but the Ubuntu boot started immediately, then press the Esc key immediately after completing the BIOS diagnostics. In the boot menu, select Advanced options for Ubuntu or its version in Russian translation.
Step 3
Then select the menu item marked recovery mode or "recovery mode" in Russian translation. The operating system will start loading in recovery mode.
Step 4
If the root user password has not been set, you will receive a console prompt with a # symbol after booting to indicate that you are in the root session. All you need to do to change your password is enter the passwd username command, where username is the name of the user whose password you want to change. The command will ask you to enter and confirm a new password. After that, restart your computer with the reboot command and log in as usual.
Step 5
If the root password has been set and you know it, then in recovery mode you will be asked to enter it before you can change the user password. However, if you don't know it, you can work around it by changing the kernel boot parameters. To do this, select the usual option in the boot menu with the cursor, but instead of Enter, press the "e" key.
Step 6
In the editor that opens, find the line starting with the word linux, add init = / bin / sh to the end of the line and press F10 to boot.
Step 7
Next, you need to mount the root file system in read / write mode. To do this, run the command mount -o remount, rw /
Step 8
Then run the command to change the password passwd username. You can change the root password in the same way. After changing the password, restart the computer with the reboot command or run the init command.