I tried to find the difference between setuid and seteuid function. At that time, many of them says the following is the difference. It is showed in the man page of setuid.
Thus, a set-user-ID-root program wishing to temporarily drop root privileges, assume the identity of an unprivileged user, and then regain root privileges afterward cannot use
setuid(). You can accomplish this withseteuid(2).
I have a doubt in the above man page reference. Using setuid we can set the effective user id of the process. For Ex:
setuid(getuid());
After this statement is executed, the effective userid of the process is changed to current user. So, to regain the root permission, I simply use,
setuid(0);
But why the man page reference shows
afterward cannot use setuid(). You can accomplish this with seteuid(2)