The GRUB (Grand Unified Bootloader) is a bootloader that is used
by many Linux distributions to boot the operating system. You can set a
password for GRUB to protect the boot process and prevent unauthorized
changes to the boot options.
To set a password for GRUB in
Linux, follow these steps:
1) Open a terminal window on your Linux machine.
2) Run the grub-mkpasswd-pbkdf2 command to generate a password hash.
For example:
$ sudo grub-mkpasswd-pbkdf2
This will prompt you to enter a password and confirm it. The command will then output a password hash.
3) Edit the GRUB configuration file using a text editor. The
file is usually located at /etc/grub.d/40_custom, but the location may
vary depending on your distribution.
$ sudo nano /etc/grub.d/40_custom
4) Add the following lines to the configuration file, replacing
<username> with your desired username and <password_hash>
with the password hash generated in step 2:
set superusers="{username}" password_pbkdf2 {username} {password_hash}
5) Save and close the configuration file.
6) Run the update-grub command to update the GRUB
configuration.
$ sudo update-grub
7) Reboot your machine and test the password by pressing e at the
GRUB boot menu to edit the boot options. You should be prompted for
the password before you can make any changes.
It's important to note that the password protection provided by
GRUB is only as secure as the password you set. Choose a strong, unique
password to protect your system from unauthorized access.
That's it! If you have any problem regarding this, please comment below.
Also Read -
How to create a ESP8266 Wi-Fi Deauthenticator in just $4
DIY WiFi Repeater with an ESP8266: A Step by Step Guide
How to do rogue AP attack in Linux using WifiPumpkin3