So there are two types of passwords that you can set, and that's the password for modifications
or the password for booting. On RHEL and related, you can use GRUB2.setPassword, and that will
create a file with the name boot.grub2.user.cfg which contains username and password. And
after a reboot to make changes, the user will be prompted for a password. On Ubuntu, it's
a little bit different. You need the GRUB mkpasswd pbkdf2 to generate a hashed password.
And the password starts with grub.pbkdf2, and you need to copy all of that. Next, in
the etc.grub.d directory, you create a file with the name 00__header file. And there,
the contents is first set superusers is student. That's the username that is required. And
next, you use password pbkdf2 student followed by the password that you have just generated.
And now you need to update GRUB. And the next time, you restart the system, and you need
to add the username as well as the password when you are prompting. Let me show you. So
for this demo, I'm going for the CentOS approach. Anyway, Linux Plus unofficially is for Ubuntu
as well as Red Hat family. But you will notice that the emphasis is a little bit more on the
Red Hat family. So if ever you need to guess what am I going to study for, better make sure
that you are super comfortable with the Red Hat stuff. So GRUB2 set password is entering is
asking me to enter a password. Let me enter my very secure password. There we go. And then I'm
going to use a reboot. Here's my GRUB boot menu. And there it's entering a username. Oh, what is
my username? Root followed by the password. And there we have access to the GRUB boot
interface. I never specified the username. That is correct. And let me show you what is going on
behind the scenes so that you understand a little bit more about this. So I'm back in my root cell.
And in this root cell, let's explore boot GRUB2. And in boot GRUB2 you can find the user.cfg. And
this user.cfg, that is what it is all about. So the funny thing is that we have the GRUB password
and this GRUB password by default is set for the root user. So that is how it works and how you can
secure your system with GRUB boot password.