How to Protect GRUB with Password in Linux ?

GRUB called as Grand Unified Bootloader is a default Boot loader on Unix OS. In a Linux system, anyone can log in to single-user mode and change the system settings. This is one of the security threat and to avoid this we can we require Grub to set password protected.

  1. Login with the root user.

  2. Hit the below command. It will ask for password and generate an md5 hash password. Copy it at a safe location.

    # grub-md5-crypt
    password --md5 $1$b7MLm0$UHtg4Ro6v/JrkWk8yBLMK0


  3. Open the file /boot/grub/menu.lst or /boot/grub/grub.conf and add the saved md5 password which we have generated earlier.

    # vi /boot/grub/grub.conf

          IMP Note: Please take the backup of your grub file without fail so we can restore it if there is an issue.

  1. Now, add the generated md5 password into grub.conf file as password –md5



  2. Save the file by pressing ESC and type:wq to save and exit.

  3. Reboot your server.

  4. Now, whenever you will need to edit the grub menu, you will need to provide the password as per the below image.

Related Articles

How to fix su USER Fails With "su: cannot create child process: Resource temporarily unavailable" Error in CloudLinux?

You may face the below error while switching the accounts using su command. su accutest su:...

How to zip/unzip files/folders on Centos?

Zip is a famous archive format and it is used in most operating systems. It is very easy to zip...

How to install IonCube Loader on CentOS 7 Manually?

Ioncube is a PHP module which protects the PHP application's source code from being viewed from...

Is it possible to take complete VPS backup in VPS itself?

Please note that, there is no provision to take backup of full VPS image in VPS itself. As an...

5 Wget Command Examples to Download Files in Linux.

wget is used to download your files from the remote server. It is used mostly on Linux...

  • 0 Users Found This Useful

Was this answer helpful?