Reset Root-Password using GRUB

Imagin you forgot your root password after a long vacation at work or you are new to a company and need to get care of old systems with no known credentials or documentation of the system. So what do you do? – Reinstall the hole machine would be a solution but all data will be gone. You could boot up with a boot stick and backup the data or crack the hashes from the shadow file. We will just change the root password so that we are able to login again. We will use a VM which runs the latest version of Lubuntu.

So lets start, while booting the machine press shift so get to boot menu.

Select Ubuntu and press e to edit the entry. Now are able to edit the grub config. Navigate to the line where you can locate the task to load the boot-disk.

Navigate to the end of the line and add (AFTER the $vt_handoff) the following command to spawn a root-shell while boot


Notice that the boot-loader will have U.S. keyboard layout. You can make the slashes and the equal sign like this on a ISO DE layout:

equal sign

Now we have our root shell but we are just able to read not to write so we have to remount with read and wirte. We do this with the following command

mount -o remount, rw /

You can make the dash with the key 0 on ISO DE layout. Now we have write privileges and can change our password with passwd.

🖤 Did this article help you?
Buy me a coffee and support my work to keep this space 🚀 and ad-free. If you can’t, share my work to reach this 📖 out to more people.

Leave a reply

Your email address will not be published. Required fields are marked *