Miguel,
Have you checked to see the return code from the setuid function?
I'd bet anything that it is failing with EPERM. From the manpage :
If the user is root or the program is setuid root, special
care must be taken. The setuid function checks the effec
tive uid of the caller and if it is the superuser, all
process related user ID's are set to uid. After this has
occurred, it is impossible for the program to regain root
privileges.
What you are attempting to do is equivalent to attempting to
"regain" root access - which for security reasons is not allowed.
If your intent is to get stuff executed with root access, use the
setuid bit on the executable. But be carefull! For more details, read the
FAQ at http://www.linux-learn.org/faqs .
Regards,
Kenneth
On Thu, 22 Jul 1999, Miguel G. wrote:
>
>
> it may be too stupid but...
>
> setui(0);
> system("command");
>
> 'command' doensn't get executed with UID 0 (runtime) any one could tell
> me why, and a walkaround?
>
>
>
> --
> -------------------------------------------
> LINUX: a free OS for free minds.
>
>