I'm trying to edit the grub.cfg file so it has a password for entering the command line (it opens after 'e' is pressed). I can't do it by editing the scripts at /etc/grub.d/, as it's not my personal computer and my boss already edited grub.cfg and grub-update would erase his changes (I tried to do it and it wouldn't work).
Right now it looks like this:
Debian
Advanced Options
Debian is the default option and can be accessed by anyone. Advanced Options is a submenu with several menuentries and needs a password (this is done by setting user and password right after the submenu brakcets)
The thing is, if someone presses 'e', he can access the comand line and therefore become root easily.
I found that what I want should be done on 40_custom or 41_custom, so I did this directly on grub.cfg:
### BEGIN /etc/grub.d/40_custom ###
# This file provides an easy way to add custom menu entries. Simply type the
# menu entries you want to add after this comment. Be careful not to change
# the 'exec tail' line above.
set superusers="root"
password_pbkdf2 root grub.pbkdf2.sha512...
### END /etc/grub.d/40_custom ###
After that, I restart and the password is requested for everything, also for the first menuentry (Debian), which shouldn't.
I tried the same with 41_custom:
### BEGIN /etc/grub.d/41_custom ###
if [ -f \${config_directory}/custom.cfg ]; then
source \${config_directory}/custom.cfg
elif [ -z "\${config_directory}" -a -f \$prefix/custom.cfg ]; then
source \$prefix/custom.cfg;
fi
set superusers="root"
password_pbkdf2 root grub.pbkdf2.sha512...
### END /etc/grub.d/41_custom ###
Same result.
I've read everything I found and I can't see what I'm missing. Sorry if I didn't make myself clear, as english is not my first language, but thanks so much.