I use the following script (based on code here) to reboot to windows, so I can stop kicking myself every time I start daydreaming and miss the boot menu.
#!/bin/bash
ENTRY=$( grep Windows /boot/grub2/grub.cfg | head -n 1 | cut -d"'" -f2 )
echo Rebooting to \"$ENTRY\"
sudo grub2-reboot "$ENTRY" && reboot
However I need sudo
and have to type a password or I get this:
/usr/bin/grub2-editenv: error: cannot open ‘/boot/grub2/grubenv’: Permission denied.
It's a symlink, /boot/grub2/grubenv -> /boot/efi/EFI/fedora/grubenv
, and owned by root
.
The command reboot
works just fine as a regular user in Fedora 23. How can I make grub2-reboot
work as well, but in a secure way?
I was thinking something along the lines of a stick bit on grub2-editenv
, but that doesn't sound good. A sticky bit on my script won't work (a good thing). Changing permissions on the file /boot/efi/EFI/fedora/grubenv
would work but might open up more possibilities than intended.