OCI: How to Password Protect the GRUB2 Boot Menu
in Linux
Applies to:
Oracle Cloud Infrastructure - Version N/A and later
Linux x86-64
Goal:
This document outlines the steps required to enable password protection on the grub2 boot menu. Once the password is set, it will require the password in order to boot into single user mode.
Solution:
Run the following command:
$ sudo grub2-setpassword Enter password: Confirm password:
The “grub2-setpassword” creates the “user.cfg” file.
For BIOS installations:
/boot/grub2/user.cfg
For UEFI installations:
/boot/efi/EFI/redhat/user.cfg
When attempting to boot to single user, the following prompt is displayed:
Enter username:
The “username” defaults to
0