This section describes the functions for altering the user ID (real and/or effective) of a process. To use these facilities, you must include the header files `sys/types.h' and `unistd.h'.
The seteuid
function returns a value of 0
to indicate
successful completion, and a value of -1
to indicate an error.
The following errno
error conditions are defined for this
function:
EINVAL
EPERM
Older systems (those without the _POSIX_SAVED_IDS
feature) do not
have this function.
If the process is not privileged, and the system supports the
_POSIX_SAVED_IDS
feature, then this function behaves like
seteuid
.
The return values and error conditions are the same as for seteuid
.
-1
, it means
not to change the real user ID; likewise if euid is -1
, it
means not to change the effective user ID.
The setreuid
function exists for compatibility with 4.3 BSD Unix,
which does not support file IDs. You can use this function to swap the
effective and real user IDs of the process. (Privileged processes are
not limited to this particular usage.) If file IDs are supported, you
should use that feature instead of this function. See section Enabling and Disabling Setuid Access.
The return value is 0
on success and -1
on failure.
The following errno
error conditions are defined for this
function:
EPERM
Go to the first, previous, next, last section, table of contents.