I have following question: Program A has to be run as root. Program A executes program B, which must not be run as root.
A: -rwsr-xr-x root root
B: -rwxr-xr-x user users
if(pid=fork() == 0)
// here euid=0, uid=29999
seteuid(getuid()); // trying to become a user
// do something
B behaves like it has been started from shell as root (~# B), and won't run. B runs if it is started as user (~$ B). How can I run B as user?