It's per security measure on Ubuntu that the kernel just ignores the suid bit on all non-compiled executables ( Interpreted ).
It can be a serious security breach because anyone can change the script and populate it by anything he wants.
To do so ; knowing the risks ; You have to wrap your script with a non-interpreted language like C.
You can do ; create C file <path_to_to_your_prog>.c :
#include <stdio.h>
#include <stdlib.h>
#include <sys/types.h>
#include <unistd.h>
int main() {
setuid( 0 );
system("<path_to_your_script>.sh" );
return 0;
}
Then compile it :
gcc <path_to_to_your_prog>.c -o
<path_to_the compiled_prog>
Then set the correct permissions :
chmod 4755 <path_to_the compiled_prog> # note the suid set here
chown root:root <path_to_the compiled_prog> <path_to_your_script>.sh
chmod 700 <path_to_your_script>.sh
Then run it :
<path_to_the_compiled_prog>
Solution 2 : Preferred
You can add a new group and make it as the secondary group of all the concerned users, then add it to your sudoers so they can run : sudo <script_path>.sh
then set the correct permissions : 750
and onwership root:<gid>
so they will be unable edit it.