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 AT&T UNIX.