sys_setreuid  [kernel/sys.c]


Sets real and effective user IDs of the current process.

Arguments

eax 70
ebx New real UID. Supplying a value of -1 forces the system to leave that ID unchanged.
ecx New effective UID. Supplying a value of -1 forces the system to leave that ID unchanged.

Return values

If the system call succeeds the return value is 0.
If the system call fails the return value is one of the following errno values:

-EPERM The current process is not privileged (does not have the CAP_SETUID capability) and a change other than (i) swapping the effective user ID with the real user ID, or (ii) setting one to the value of the other or (iii) setting the effective user ID to the value of the saved set-user-ID was specified.

Remarks

Unprivileged users may change the real UID to the effective UID or vice versa.

If you set the real UID at all, or set the effective UID to a value not equal to the real UID, then the saved UID is set to the new effective UID.
This makes it possible for a setgid program to completely drop its privileges, which is often a useful assertion to make when you are doing a security audit over a program.

Compatibility

n/a