Ubuntu 18.04 Gnome de.
I made a simple bash script file that flags my next reboot to choose the windows grub entry. For quick rebooting into windows straight from Linux DE.
The problem is I have to use dconf to modify executable files to ask, so I can click run in terminal where it automatically asks for password. Otherwise, just executing the file does nothing, bc it’s waiting for a password input.
Is there a way to run a bash script file like this with inherent sudo privileges so it doesn’t need to ask for a password?
EDIT (even though it’s directed at @waltinator, because comment formatting is atrocious):
be the location and name of my bash script file? for example, my bash script file is named restart2windows and is located on my desktop:
so I would just need to add this line to /etc/sudoers (I’m still unclear on editing that file, using visudo, and whether I should edit sudoers.d as advised):
myusername mymachinename = NOPASSWD: /home/myusername/Desktop/restart2windows
Would this be correct?
I tried editing sudoers via visudo:
and added the line I suggested above, below the commented line:
and then tried to run my bash script file from my desktop, and it did nothing. If I choose to run it in the terminal, the terminal is waiting for a password input.
Here is my bash script file contents, very simple:
#!/bin/bash sudo grub-reboot 2 sudo reboot now
Found this question here and it appears that I need to add sudo somewhere in there? I’m confused by that answer to that question because his line of code from the OP does not match the OP’s.