How to set Grub Password in UBUNTU 18.03 (Password protect Boot Loader)
- First, open a terminal from Ubuntu’s applications menu
- Take backup of two files : cp /etc/grub.d/40_custom /etc/grub.d/40_custom.old and cp /boot/grub/menu.lst /boot/grub/menu.lst.bkp
- Generating a Password Hash : Just type grub-mkpasswd-pbkdf2 and press Enter
4. Setting a Password: Type sudo vi /etc/grub.d/40_custom to open the 40_custom file in the Nano text editor. This is the place where you should put your own custom settings. They may be overwritten by newer versions of Grub if you add them elsewhere.
scroll down to the bottom of the file and add a password entry in the following format:
set superusers=”name”
password_pbkdf2 <superusers_name>[long string from earlier]
5. Open /boot/grub/menu.lst file and follow the below steps
a. Generate md5 password : echo -n <password> | md5sum
b. Open vi /boot/grub/menu.lst and add following lines
c. password --md5 <paste generated password>
d. save and exit
6. Activating Your Changes: run the sudo update-grub command and restart the system.
7. If you have password protected boot entry, you’ll see a login prompt when you start your computer.
8. For remove the Boot or GRUB password remove the entries from /boot/grub/menu.lst and /etc/grub.d/40_custom files and run update-grub then restart the machine
9. Enjoy