setuid

SETUID(3)                 BSD Library Functions Manual                 SETUID(3)

NAME
     setuid, seteuid, setruid, setgid, setegid, setrgid — set user and group ID

SYNOPSIS
     #include <sys/types.h>

     int
     setuid(uid_t uid);

     int
     seteuid(uid_t euid);

     int
     setruid(uid_t ruid);

     int
     setgid(gid_t gid);

     int
     setegid(gid_t egid);

     int
     setrgid(gid_t rgid);

DESCRIPTION
     The setuid() function (setgid()) sets both the real and effective user ID
     (group ID) of the current process as specified.

     The seteuid() function (setegid()) sets the effective user ID (group ID) of
     the current process.

     The setruid() function (setrgid()) sets the real user ID (group ID) of the
     current process.

RETURN VALUES
     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 or
     effective ID, these functions return -1.

SEE ALSO
     setreuid(2), setregid(2), getuid(2), getgid(2)

HISTORY
     A setuid() and setgid() syscall appeared in Version 6 AT&T UNIX.

4.2 Berkeley Distribution        April 19, 1991        4.2 Berkeley Distribution