setuid(3) setuid(3)NAME setuid, setgid - set user and group IDs SYNOPSIS int setuid(uid) int uid; int setgid(gid) int gid; DESCRIPTION setuid (setgid) is used to set the real user (group) ID and effective user (group) ID of the calling process. If the effective user ID of the calling process is su- peruser, the real user (group) ID and effective user (group) ID are set to uid (gid). If the effective user ID of the calling process is not su- peruser, but its real user (group) ID is equal to uid (gid), the effective user (group) ID is set to uid (gid). If the effective user ID of the calling process is not su- peruser, but the saved set-user (group) ID from exec(2) is equal to uid (gid), the effective user (group) ID is set to uid(gid). RETURN VALUE Upon successful completion, a value of 0 is returned. Oth- erwise, a value of -1 is returned and errno is set to indi- cate the error. ERRORS setuid (setgid) will fail if one of the following is true: [EPERM] the real user (group) ID of the calling process is not equal to uid (gid) and its effective user ID is not superuser. [EINVAL] The uid (gid) is out of range. SEE ALSO getuid(2), intro(2), setregid(2), setreuid(2). March, 1990 1