This short article describe how to reset lost root password on Linux system. IMPORTANT: This method require physical access to the machine.
On GRUB screen select normal boot option:
Search for the line starting with “linux /boot/vmlinuz…” or similar depending of Linux distribution. This is the place where kernel and rootfs is selected. Change ‘ro’ option to ‘rw’ and add:
at the end of line. Mentioned line should look like on the following image.
Now you can boot a system with new kernel options. Press ‘Ctrl-X’ or F10 to boot.
Wait until system is started. You should see something like that.
Search for ‘root’ user line. Delete whole password hash for this user (all characters between ‘:’ chars). Save file.
and reboot machine.
After reboot you can login as ‘root’ without password. IMPORTANT: Set new password as soon as possible using ‘passwd’ command.