1 00:00:00,000 --> 00:00:11,400 So there are two types of passwords that you can set, and that's the password for modifications 2 00:00:11,400 --> 00:00:17,680 or the password for booting. On RHEL and related, you can use GRUB2.setPassword, and that will 3 00:00:17,680 --> 00:00:24,879 create a file with the name boot.grub2.user.cfg which contains username and password. And 4 00:00:24,879 --> 00:00:31,040 after a reboot to make changes, the user will be prompted for a password. On Ubuntu, it's 5 00:00:31,040 --> 00:00:39,439 a little bit different. You need the GRUB mkpasswd pbkdf2 to generate a hashed password. 6 00:00:39,439 --> 00:00:45,959 And the password starts with grub.pbkdf2, and you need to copy all of that. Next, in 7 00:00:45,959 --> 00:00:54,200 the etc.grub.d directory, you create a file with the name 00__header file. And there, 8 00:00:54,200 --> 00:01:00,520 the contents is first set superusers is student. That's the username that is required. And 9 00:01:00,520 --> 00:01:08,839 next, you use password pbkdf2 student followed by the password that you have just generated. 10 00:01:08,839 --> 00:01:13,239 And now you need to update GRUB. And the next time, you restart the system, and you need 11 00:01:13,239 --> 00:01:20,480 to add the username as well as the password when you are prompting. Let me show you. So 12 00:01:20,480 --> 00:01:29,760 for this demo, I'm going for the CentOS approach. Anyway, Linux Plus unofficially is for Ubuntu 13 00:01:29,760 --> 00:01:34,760 as well as Red Hat family. But you will notice that the emphasis is a little bit more on the 14 00:01:34,760 --> 00:01:40,559 Red Hat family. So if ever you need to guess what am I going to study for, better make sure 15 00:01:40,559 --> 00:01:46,760 that you are super comfortable with the Red Hat stuff. So GRUB2 set password is entering is 16 00:01:46,760 --> 00:01:54,239 asking me to enter a password. Let me enter my very secure password. There we go. And then I'm 17 00:01:54,239 --> 00:02:01,720 going to use a reboot. Here's my GRUB boot menu. And there it's entering a username. Oh, what is 18 00:02:01,720 --> 00:02:08,240 my username? Root followed by the password. And there we have access to the GRUB boot 19 00:02:08,279 --> 00:02:14,080 interface. I never specified the username. That is correct. And let me show you what is going on 20 00:02:14,080 --> 00:02:19,880 behind the scenes so that you understand a little bit more about this. So I'm back in my root cell. 21 00:02:19,880 --> 00:02:27,559 And in this root cell, let's explore boot GRUB2. And in boot GRUB2 you can find the user.cfg. And 22 00:02:27,559 --> 00:02:33,639 this user.cfg, that is what it is all about. So the funny thing is that we have the GRUB password 23 00:02:33,639 --> 00:02:39,600 and this GRUB password by default is set for the root user. So that is how it works and how you can 24 00:02:39,600 --> 00:02:42,639 secure your system with GRUB boot password.