Run a shell script with setuid

Linux has protections in place to prevent you from running shell scripts with root permissions that have the setuid bit set.
But there’s a way to work around that. (yay! but also be careful!)
You’ll need to create a binary with setuid on it…. Here’s how to create the binary:

Create the your C file (somefile.c)

int main()
   setuid( 0 );
   system( "/yourpath/to/yourscript.bash" );
   return 0;

Compile it:
gcc somefile.c -o somefile

Set permissions on it:
chown root:root somefile
chmod 4755 somefile