SUSE Support

Here When You Need Us

Allow any user to run GRUB menu entry, while password protect menu entry edit and GRUB shell.

This document (000020871) is provided subject to the disclaimer at the end of this document.

Environment

SUSE Linux Enterprise Server 15 All Releases
SUSE Linux Enterprise Server 12 All Releases

Situation

Administrators want to password protect GRUB menu entry edit and the GRUB shell, while allow any user to run a menu entry without username and password.

Resolution

Add the --unrestricted option to menuentry.

For example, the following changes to /etc/grub.d/10_linux will allow the default menu entry to be run by any user. The system will boot automatically. If users edit the default menu entry, username and password will be prompted to proceed.
--- a/10_linux
+++ b/10_linux
@@ -27,6 +27,8 @@
 export TEXTDOMAINDIR="${datarootdir}/locale"

 CLASS="--class gnu-linux --class gnu --class os"
+# Allow any user to execute a menu entry while superusers is set
+MENUENTRY_UNRESTRICTED="--unrestricted"

 if [ "x${GRUB_DISTRIBUTOR}" = "x" ] ; then
   OS=GNU/Linux
@@ -138,7 +140,7 @@
       echo "menuentry '$(echo "$title" | grub_quote)' $(print_hotkey) ${CLASS} \$menuentry_id_option 'gnulinux-$version-$type-$boot_device_id' {" | sed "s/^/$submenu_indentation/"
       hotkey=$(incr_hotkey)
   else
-      echo "menuentry '$(echo "$os" | grub_quote)' $(print_hotkey) ${CLASS} \$menuentry_id_option 'gnulinux-simple-$boot_device_id' {" | sed "s/^/$submenu_indentation/"
+      echo "menuentry '$(echo "$os" | grub_quote)' $(print_hotkey) ${CLASS} ${MENUENTRY_UNRESTRICTED} \$menuentry_id_option 'gnulinux-simple-$boot_device_id' {" | sed "s/^/$submenu_indentation/"
       hotkey=$(incr_hotkey)
   fi
   if [ x$type != xrecovery ] ; then

Create new grub.cfg for the next boot
grub2-mkconfig -o /boot/grub2/grub.cfg

Cause

When GRUB boot password is set, GRUB prompts for username and password to run all menu entries.

Additional Information

Reference:
  • https://documentation.suse.com/sles/15-SP4/html/SLES-all/cha-grub2.html#sec-grub2-password
  • https://www.gnu.org/software/grub/manual/grub/grub.html#Authentication-and-authorisation

Disclaimer

This Support Knowledgebase provides a valuable tool for SUSE customers and parties interested in our products and solutions to acquire information, ideas and learn from one another. Materials are provided for informational, personal or non-commercial use within your organization and are presented "AS IS" WITHOUT WARRANTY OF ANY KIND.

  • Document ID:000020871
  • Creation Date: 22-Nov-2022
  • Modified Date:06-Jan-2023
    • SUSE Linux Enterprise Server

< Back to Support Search

For questions or concerns with the SUSE Knowledgebase please contact: tidfeedback[at]suse.com

SUSE Support Forums

Get your questions answered by experienced Sys Ops or interact with other SUSE community experts.

Support Resources

Learn how to get the most from the technical support you receive with your SUSE Subscription, Premium Support, Academic Program, or Partner Program.

Open an Incident

Open an incident with SUSE Technical Support, manage your subscriptions, download patches, or manage user access.