SETUID(2)

NAME
setuid, setgid, setruid, setlogname - set userid and groupid

SYNOPSIS
int setuid(uid)

int setgid(gid)

int setruid(uid)

int setlogname(buf)
char buf[8];

DESCRIPTION
Setuid (setgid) sets the effective and real userid (groupid) of the current process to uid (gid). Both the effective and the real userid (groupid) are set. Setruid only sets the real userid. These calls are only permitted to the super-user or if the argument is the real or effective userid. Setruid may only be used by the super-user.

Setlogname sets the login name returned by getlogname. Only the super-user may use this call. For all of these calls, capability T_UAREA is required whenever superuser status is required; see getplab(2).

Certain ids have predefined uses:

    uid 0    superuser
    gid -1    automatically assigned to /proc files

SEE ALSO
getuid(2)

DIAGNOSTICS
EFAULT (setlogname only), EPERM