Steve Fosdick fozzy@pelvoux.demon.co.uk writes:
My guess is that root efective uid established by having the perl script setuid is not being passed on to the child process that is started by system().
It is passed on, but by default bash resets the effective uid to the real uid.
In C I think the workaround is to call:
setuid(geteuid());
This sets the real and saved uids to the same as the effective uid so from then on the process looks just like one that was run by root rather than one which is setuid (a setuid process has effectice uid set from the file, by real uid and saved uid come from the invoking user).
Hopefully perl will have the equivalent to the C functions above.
"$< = $>;" should do it. I've never really trusted setuid scripts, Perl or otherwise, though. userv is often a better approach. http://www.chiark.greenend.org.uk/~ian/userv/