I have a program to run as root, and during execution this program will do a few things as different uers, so I wanted to use a serial of setuid()s. But, I found that, after setuid(user1), I become user1 and thus don't have the privilege to do setuid(user2).
How can I get back to root so that I can do setuid(user2)?
Thanks.