Skip to content

Instantly share code, notes, and snippets.

@AfroThundr3007730
Created April 16, 2019 06:51
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save AfroThundr3007730/fc43be4a56cfe03eaabf95ee03dba613 to your computer and use it in GitHub Desktop.
Save AfroThundr3007730/fc43be4a56cfe03eaabf95ee03dba613 to your computer and use it in GitHub Desktop.
Password protect GRUB configuration
#!/bin/sh -e
cat << EOF
if [ -f \${prefix}/user.cfg ]; then
source \${prefix}/user.cfg
if [ -n "\${GRUB2_PASSWORD}" ]; then
set superusers="root"
export superusers
password_pbkdf2 root \${GRUB2_PASSWORD}
fi
fi
EOF
GRUB2_PASSWORD=grub.pbkdf2.sha512.10000.DEADBEEF... # replace with output of `grub-mkpasswd-pbkdf2`
@AfroThundr3007730
Copy link
Author

  1. Copy 01_users to /etc/grub.d/ and make executable.
  2. Create user.cfg in the grub boot directory (next to grub.cfg).
  3. Append --unrestricted to the CLASS variable in /etc/grub.d/10_linux.
  4. Run grub-mkconfig -o /path/to/grub.cfg to update grub.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment