I have only one user and my grub boot menu also won't load so I don't know any other way to change password
1 Answer
First, you want to boot up your machine, and shortly after the BIOS/UEFI has run, you'll want to hold down the left Shift key until you arrive at the GRUB bootloader menu. It should have a purple background with white text, assuming that it hasn't been customised)
Push the arrow keys until the entry with the words
Advanced options for Ubuntu
in the description is highlighted, and push the Enter key. Then, select an option with the words, "Recovery mode" at the end. Now push the Enter key. There will be a literal flood of diagnostic bootup text, but that should be nothing to worry about.
The part that we are interested in is the recovery menu. It should have a light purple background, with a dialogue in the centre of the screen. Take note of the filesystem's current state, which is shown at the top of the dialogue. It's usually read-only at recovery mode.
Push the arrow keys down until you get to the option,
root
This option will make the user a temporary administrator for the recovery session.
You should now see a prompt that looks like this,
root@ubuntu:~#
If your filesystem's state is in read-only (It should be), you will need to type the following command out. This will remount your file system with write privileges.
mount -rw -o remount /
Now the fun part! Let's change your password with the passwd
command. Lets assume that the user's name is hannah
. We would need to type these commands into the prompt.
passwd hannah
Replace hannah
with your username.
You will now be asked for a new password.
Enter new UNIX password:
Type it out again for security and verification purposes.
Retype new UNIX password:
Your password should now be updated.
passwd: password updated successfully
You should now reboot your computer, and check if the password works. Type
reboot
into the prompt.