setreuid(SSC) 6 January 1993 setreuid(SSC) Name setreuid - set real and effective user IDs Syntax int setreuid(ruid, euid) int ruid, euid; Description setreuid is used to set the real and effective user IDs of the calling process. If ruid is -1, the real user ID is not changed; if euid is -1, the effective user ID is not changed. The real and effective user IDs may be set to different values in the same call. If the effective user ID of the calling process is super-user, the real user ID and the effective user ID can be set to any legal value. If the effective user ID of the calling process is not super-user, either the real user ID can be set to the effective user ID, or the effective user ID can either be set to the saved set-user ID from execve(SSC) or the real user ID. Note that if a set-UID process sets its effective user ID to its real user ID, it can still set its effective user ID back to the saved set-user ID. In either case, if the real user ID is changed to a particular value (that is, if ruid is not -1), the saved set-user ID is set to that same value. Return value A return value of zero indicates that the call succeeded. A return value of -1 indicates that an error occurred, and in this case an error code is stored in the global variable errno. Errors setreuid will fail and neither of the user IDs will be changed if: EPERM The calling process' effective user ID is not the super- user and a change other than changing the real user ID to the effective user ID, or changing the effective user ID to the real user-id or the saved set-user ID, was speci- fied. See also getuid(S), execve(S), setregid(SSC), setreuid(SSC) and setuid(S).