reset user password using GRUB and set grub password in the end Ubuntu 14.04 LTS

on boot menu

select  "e" to edit the menu item
find line starting with "linux..." and in the end append  init=/bin/bash
and press
ctrl+x

mount -o remount,rw /
passwd <username>
reboot -f

To set grub password

login as root

# grub2-mkpasswd-pbkdf2 
OR
grub-mkpasswd-pbkdf2

Password: ****
Reenter password: ****
PBKDF2 hash of your password is grub.pbkdf2.sha512.10000.9CA4611006FE96BC77A

Paste the encrypted long string into the file /etc/grub.d/40_custom

eg. copy the content starting from "grub.pbkdf2.sha512.10000.9CA461100..."

vim /etc/grub.d/40_custom

set superusers="root"
password_pbkdf2 root grub.pbkdf2.sha512.10000.9CA4611006FE96BC77A...

grub2-mkconfig -o /boot/grub2/grub.cfg
or 
grub-mkconfig -o /boot/grub2/grub.cfg

if on the local terminal use help of "tee"

grub-mkpasswd-pbkdf2 | tee myhelper.txt

your password content and other text are copied in myhelper.txt, edit this myhelper.txt file and cat its content to /etc/grub.d/40_custom

cat myhelper.txt >> /etc/grub.d/40_custom
grub-mkconfig -o /boot/grub2/grub.cfg

No comments:

Post a Comment