SETUID(3) BSD SETUID(3)
NAME
setuid, seteuid, setruid, setgid, setegid, setrgid - set user and group
ID
SYNOPSIS
#include <sys/types.h>
setuid(uid)
seteuid(euid)
setruid(ruid)
uid_t uid, euid, ruid;
setgid(gid)
setegid(egid)
setrgid(rgid)
gid_t gid, egid, rgid;
DESCRIPTION
setuid (setgid) sets both the real and effective user ID (group ID) of
the current process to as specified.
seteuid (setegid) sets the effective user ID (group ID) of the current
process.
setruid (setrgid) sets the real user ID (group ID) of the current
process.
These calls are only permitted to the super-user or if the argument is
the real or effective ID.
NOTES
Under some implementations of the UNIX operating system, the setgid call
will modify the supplementary group list. This is not the case under
Domain/OS.
At login time, the user's native group is automatically added to the
supplementary group list. Therefore, a setgid call will leave the user
in that original group (since the supplementary list is not changed).
Note that on a native BSD system, the setgid system call purges old
native group from the supplementary group list and adds the new group to
it.
SEE ALSO
intro(2), getgid(2), getoid(2), getuid(2), setregid(2), setreoid(2),
setreuid(2), setoid(3).
DIAGNOSTICS
Zero is returned if the user (group) ID is set; -1 is returned otherwise.