.\" Copyright (c) 1983, 1991 Regents of the University of California.
.\" %sccs.include.redist.man%
.\" @(#)setuid.2 6.7 (Berkeley) %G%
.Nd set user and group ID
.Fd #include <sys/types.h>
sets the real and effective
user IDs and the saved set-user-ID of the current process
function is permitted if the specified ID is equal to the real user ID
of the process, or if the effective user ID is that of the super user.
sets the real and effective
group IDs and the saved set-group-ID of the current process
function is permitted if the specified ID is equal to the real group ID
of the process, or if the effective user ID is that of the super user.
sets the effective user ID (group ID) of the
The effective user ID may be set to the value
of the real user ID or the saved set-user-ID (see
in this way, the effective user ID of a set-user-ID executable
may be toggled by switching to the real user ID, then re-enabled
by reverting to the set-user-ID value.
Similarly, the effective group ID may be set to the value
of the real group ID or the saved set-user-ID.
Upon success, these functions return 0;
otherwise \-1 is returned.
If the user is not the super user, or the uid
specified is not the real, effective ID, or saved ID,
these functions return \-1.
functions are compliant with the
functions are extensions based on the
and have been proposed for a future revision of the standard.