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 12 All Releases
Situation
Resolution
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
Additional Information
- 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
For questions or concerns with the SUSE Knowledgebase please contact: tidfeedback[at]suse.com