I have a script that I've made that needs to have root permissions to enable and disable bluetooth features. I am binding this to a button so it is not feasible to log in as root to run the script. How do I properly set the file permissions for the script? I know that it's good practice to make it so that only root can edit and read the file, but how do I give it full execution permissions?
BT_RFKILL=$(rfkill list | grep tpacpi_bluetooth_sw | sed 's/\([0-9]\+\):.*/\1/')
BT_STATE=$(rfkill list $BT_RFKILL | grep "Soft blocked: yes")
if [ "x" == "x$BT_STATE" ]; then
sixad --stop
sleep 2s
rfkill block $BT_RFKILL
else
rfkill unblock $BT_RFKILL
sleep 2s
sixad --start
fi
exit 0
The script runs perfectly if I sudo it, but that's not ideal since I'd love run it through a simple key binding.