Download as pdf or txt
Download as pdf or txt
You are on page 1of 4

By default the first user's account is an administrative account, so if the UI is prompting

you for a password it's probably that person's user password. If the user doesn't
remember their password you need to reset it. To do this you need to boot into recovery
mode (see also offical docs: RecoveryMode).
Boot up the machine, and after the BIOS screen, hold down the left Shift key (note that for
UEFI BIOS you might need press ESC instead). You will then be prompted by a menu that
looks something like this:

I've noticed on some systems that timing when to hit the left Shift key can be tricky,
sometimes I miss it and need to try it again.
Hit the down arrow until you select the 2nd entry from the top (the one with
the recovery mode in the description) and then hit Enter .
Now you should see this menu:
Using the arrow keys scroll down to root and then hit Enter .
You should now see a root prompt, something like this:

root@ubuntu:~#
At this stage you should have a read-only filesystem. You have to remount it with write
permissions:

mount -o remount,rw /
Now we can set the user's password with the passwd command. (In this example I will use
jorge as the example, you need to substitute whatever the user's username is):
root@ubuntu:~# passwd jorge
Enter new UNIX password:
Retype new UNIX password:
passwd: password updated successfully
root@ubuntu:~#
Type in what you want the new password to be at the prompt. After it's successful reboot
the machine and the user will be able to log in with their new password.

• Recovery Mode documentation


• Lost password documentation

There is concern about this being a security vulnerability. It is not. You need to have
physical access to the machine to do this. If someone has physical access to your PC, they
could do far worse than change a password. When it comes to physical access, the battle
for security is lost. Be wary of who you let on your PC.
Even setting a root password will not be successful, as one can simply boot
with init being /bin/sh and have full root access. Again, given physical access, anyone with
computer knowledge can do ANYTHING to your computer.
shareimprove this answer
edited Aug 20 at 15:06

Nux
11255 bronze badges
answered Jan 30 '11 at 17:03

Jorge Castro
38.9k110110 gold badges430430 silver badges624624 bronze badges
• 6
Google needs to learn this. – Nonny Moose Jul 28 '18 at 18:13
• 2
I didn't have to remount – Aadishri Oct 24 '18 at 16:07
• 1
So plain simple. – gies0r Oct 28 '18 at 17:04
• 1
Lenovo Laptop is painful to get to recovery mode. The solution is just after BIOS (i.e. Lenovo logo)
press "ESC" holding the left shift key. – Milan Kamilya Jan 11 at 7:03
• 2
"select the 2nd entry from the top" - that might not be accurate, in my case 2nd entry was (upstart),
not (recovery mode) – bambosze_babuni Mar 7 at 20:18
show 3 more comments
73
Yes, you can change the old password via GRUB.
1. If you have a single-boot (Ubuntu is the only operating system on your computer), to
get the boot menu to show, you have to hold down the Shift key during bootup.
2. If you have a dual-boot (Ubuntu is installed next to Windows, another Linux
operating system, or Mac OS X; and you choose at boot time which operating system
to boot into), the boot menu should appear without the need to hold down
the shift key.
3. From the boot menu, select recovery mode, which is usually the second boot option.
4. After you select recovery mode and wait for all the boot-up processes to finish, you'll
be presented with a few options. In this case, you want the Drop to root shell
prompt option so press the ᛎ Down arrow to get to that option, and then
press Enter to select it.
5. Once you're at the root shell prompt, if you have forgotten your username as well,
type ls /home (small letters & not capitals). This will list all the user accounts in your
set up.
6. To reset the password, type passwd username where username is the username you
want to reset, for example, passwd mysterio in my case.
7. You'll then be prompted for a new password. When you type the password you will
get no visual response acknowledging your typing. Your password is still being
accepted. Just type the password and hit Enter when you're done. You'll be prompted
to retype the password. Do so and hit Enter again.
8. Now the password should be reset. Type exit to return to the recovery menu.
9. After you get back to the recovery menu, select resume normal boot, and use
Ubuntu as you normally would — only this time, you actually know the password!

You might also like