- Select the kernel
- Press the e key to edit the entry
- Select second line (the line starting with the word kernel)
- Press the e key to edit kernel entry so that you can append single user mode
- Append the letter S (or word Single) to the end of the (kernel) line. If you are using an ubuntu linux distribution remove the words "ro quiet splash" at the end of the line and instead of it add "rw init=/bin/bash"
- Press ENTER key
- Now press the b key to boot the Linux kernel into single user mode
- At prompt type passwd command to reset password:
You need to mount at least / and other partitions:
# mount -t proc proc /proc (not mandatory in ubuntu)
# mount -o remount,rw / (not mandatory in ubuntu)
Change the root password, enter:
Finally reboot system:
NOTE: There are another ways to recover a password root. One of the most well knowed is to use a live CD, mount the partition where our target linux is installed edit file /etc/passwd and remove the x of the following line "root:x:0:0:root:/root:/bin/bash" . With this action when we reboot the system we have the choice to login as root in system with an empty password. Maybe not in a graphical sessions but We can do it in the console.
If we want that grub menu will not be editable we can edit file /boot/grub/menu.lst there are a configuration line, I don’t remember wich, that we can comment and our grub menu options will not be editable at boot.