In this demonstration,
we're going to walk through how to create a password
to protect the Grub 2 configurations.
Now the Grub 2 is a bootloader.
And of course the bootloader is what's used initially
to get the operating system up and running.
It locates all the necessary resources required
for our systems to function properly.
So we're going to walk through how to protect this
Grub 2 boot loader by adding a password to it, okay?
First we need to find the grub.cfg file, config file.
Now the thing is, it depends on if you're using a UEFI
or a BIOS firmware.
I'm currently using a BIOS firmware,
which is the older type.
But if you're using UEFI,
then your location of this grub,
that CFG file is going to be in a different location.
So if you're using the UEFI, which most people probably are,
we going to look here.
And this is going to be the location of your grub cfg file,
but mine is going to be in a different location.
If you're using a BIOS system,
it's going to be in boot/grub2.
So we're going to walk through the process
of making a custom configuration file,
that will modify the grub.config file.
Okay, let's go ahead and look and see
what this config file looks like.
sudo, but my mine's in the boot folder, remember,
grub2 grub.cfg.
Okay, a lot of this is a script.
And what's going to happen is,
we're going to run a make feed command here shortly.
It's going to combine all of our custom files
to allow us to customize the menu
and the grub 2, once we reboot.
And we're going to show that a little bit later.
So again, we're about to create a password file,
under a custom file name,
and we're going to put it under our grub.d folder
under the etc directory,
and then it's going to combine everything into this one file
which is the .cfg that we're looking at now.
Okay, so let's go ahead and make this password.
Okay, so we see it created a hash for a password.
And if you were wondering the pbkdf2
that's a hashing function that's still currently used.
it's similar to SHA-1, SHA-256 SHA-128
all of those different type of hashing algorithms,
but we're going to use this one for our grub 2 file,
that's the preferred one.
Okay, so now we're going to adjust this config file,
and we're going to make sure
that it requires the password, okay.
So we're going to go ahead and modify that custom file
we just created.
use the vim editor,
better remove this entire line right here,
both three and the password as well.
Then we're just going to edit this.
We're going to put a little note here, pretty much,
password for jkelly,
and I'm going to set myself as a super user, okay.
Okay, so once you finish,
your screen should look something like this.
Now we're going to make the configuration file
and it's going to update the current one that we already have
with all the information that's in that
etc grub d folder,
the o options are specifying which file we're going to look at.
Okay, now so again, just remember I'm using bios,
if you're using UEFI your location
will be somewhere different,
it should be boot efi then slash capital EFI
and then probably centos,
and then you're going to use the grub.cfg.
Okay, so let's just reboot this really quick
and just make sure that we're going to be prompted
for a password when we try to get into the grub.
All right, going to click the escape,
so that'll stop the timer.
We're going to do e for edit.
And you see it prompts me for my password.
Now be very careful with this password
because if you mess up, there's no way to come back,
it's not a redo type of situation.
So, all right, now we're in here.
Again, all we did was go through,
and we figured out how to put restrictions
by adding a password authentication, to access the grub 2
to protect some of our valuable boot up instructions.
That concludes this lesson,
and I'll see you in the next one.