setreuid()

NAME

setreuid() - set real and effective user ID's

SYNOPSIS

#include <unistd.h>

int setreuid (uid_t ruid, uid_t euid)

DESCRIPTION

The real and effective user IDs of the current process are set according to the arguments. If ruid or euid is -1, the current uid is filled in by the system. Unprivileged users may change the real user ID to the effective user ID and vice-versa; only the superuser may make other changes.

The setreuid(2) function has been used to swap the real and effective user IDs in set-user-ID programs to temporarily relinquish the set-user-ID value. This purpose is now better served by the use of the seteuid(2) function (see setuid(2)).

When setting the real and effective user IDs to the same value, the standard setuid(2) function is preferred.

RETURN VALUES

Upon successful completion, a value of 0 is returned. Otherwise, a value of -1 is returned and errno is set to indicate the error.

ERRORS

The setreuid(2) call can fail for the following reasons:

[EPERM]
The current process is not the superuser and a change other than changing the effective user-id to the real user-id was specified.

NOTES

The appropriate privileges are granted to the following users: The SYSTEM account, the Administrator account of the principal domain, and the Administrator account of the local domain.

The local Administrator account is restricted to setting the UID to local accounts.

SEE ALSO

getuid(2)

seteuid(2)

setuid(2)