Resetting an lost admin password on Ubuntu/Linux Mint
-
If your IT department is doing things right, then the user account that you log in to a computer with will not have administrative access.
In the Linux ecosystem this is called
sudoaccess.Normally an accout is made with
sudorights that is only used as needed.If the password for this account is lost, then there is no longer a way to administer the computer.
In the Windows world, you shutdown the system and then boot to a specially crafted USB boot disk that you can read the Windows information and then reset the admin password.
For Linux, it is easier. You simply need to reboot and interrupt the normal
grubboot sequence to get into single user mode.- Reboot the system.
- As soon as it powers back on begin tapping the
ESCkey.
Technically, we are only wanting to stopgrubfrom automatically booting. but with modern SSD or NVMe drives, this can go by so fast you never knew it was available to interrupt.
- As soon as it powers back on begin tapping the
- The first grub entry should be highlighted by default and is normally the one you want. Press
eto edit that entry. - Find the line beginning with
linux - Go to the end of the line and add
init=/bin/bash - Press
F10to boot to this modified file without permanently saving it. - The system will boot to a command prompt similar to
root@(none):/# - Enter
mount -o remount,rw /and pressEnter. - Now you can reset the admin account password with the
passwdcommand:passwd YOURADMINNAME. - Enter the new password, then again to confirm it.
- Type
exitand then use the power button to reboot the computer.
- Reboot the system.