I need to run a bash script as root (passwordless sudo or su not viable) and since you cannot setuid a script in Linux, I thought about calling it from an executable and mak
Why is sudo not viable? It avoids raging security holes such as:
bash-3.2$ cat test
#!/bin/bash
echo ima shell script durp durp
bash-3.2$ chmod +x test
bash-3.2$ ./test
heh heh
bash-3.2$
Due to the environment not being properly sanitized, for example in this case:
export echo='() { builtin echo heh heh; }'
sudo sanitizes this case, and perhaps other edge cases and gotchas that would be well not to write into a custom suid wrapper.