How to give sudo access to a bash script? How to give sudo access to a bash script? bash bash

How to give sudo access to a bash script?


You make all correct, but execute the script with te full path:

$ sudo /home/ronnie/chbr.sh


Do you run sudo /home/ronnie/chbr.sh?

With the content of the file being

setpci -s 00:02.0 F4.B=30

Or you allow user ronnie to sudo setpci without password:

ronnie ALL = (ALL) NOPASSWD: /sbin/setpci <-- or whatever path your setpci resides in.


For anyone who stumbles into this old forum. You don't need sudo to change the brightness. It can be done with the “light” program where the

light -A 5

increases brightness with 5 and

light -U 5

decreases the brightness with 5.