Skip to content

Instantly share code, notes, and snippets.

@anwas
Created July 30, 2018 05:34
Show Gist options
  • Save anwas/ffcc9f7672415b0c48769afde1097457 to your computer and use it in GitHub Desktop.
Save anwas/ffcc9f7672415b0c48769afde1097457 to your computer and use it in GitHub Desktop.
[Change Ubuntu password in recovery mode] #ubuntu #password #recovery
From the boot menu, select recovery mode, which is usually the second boot option.
The root account is the ultimate administrator and can do anything to the Ubuntu installation (including erase it), so please be careful with what commands you enter in the root terminal.
In recent versions of Ubuntu, the filesystem is mounted as read-only, so you need to enter the follow command to get it to remount as read-write, which will allow you to make changes:
mount -o rw,remount
If you have forgotten your username as well, type
ls /home
To reset the password, type
passwd username
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.
Now the password should be reset. Type
exit
to return to the recovery menu.
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!
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment