Ok, I'm investigating something I'm not quite sure about and it concerns
the use of either setreuid or seteuid to change between user id's.
Here's the thing: what I'd like to do is have a program which is suid to root.
Now as soon as you enter into this program, I want it to change the effective
ID back to the calling process, since it does stuff (like creating sub-shells)
that I DON'T want it to be root as.
Anyway, after I while, I want it to open a file which is only read/writeable
by root. At this point I'd like to reset the effective user ID back to root,
open the file, do my stuff, close it, and reset euid back to real-uid.
Kinda like this:
saved_uid = geteuid();
/* normal dude */
/* now go back to root */
/* now back again to real uid */
Anyway, as it's "implemented" above, the 2nd setreuid ("back" to root)
fails, since, at this point, the process no longer has an effective root
uid. But I seem to recall a long time ago that the set-user uid was saved
somewhere to allow this to happen. In fact, I even have a few books that
mention this "technique" in writting correct suid scripts... so what's the
Or is this not even possible?? Jim Jagielski NASA/GSFC, Code 711.4 "...there is no *ism in the British Navy. Absolutely none. And
when I say none, I mean there is a certain amount..."
Jim Jagielski NASA/GSFC, Code 711.4
"...there is no *ism in the British Navy. Absolutely none. And