Museum

Home

Lab Overview

Retrotechnology Articles

Online Manuals

⇒ setgid(2) — CX/UX 6.20

Media Vault

Software Library

Restoration Projects

Artifacts Sought

Related Articles

getuid(2)

setuid(3C)

setreuid(2)

exec(2)

intro(2)



setuid(2)                 AT&T SYSTEM V                 setuid(2)



NAME
     setuid, setgid - set user and group IDs

SYNOPSIS
     #include <sys/types.h>

     uidt setuid (uid)
     uidt uid;

     gidt setgid (gid)
     gidt gid;

DESCRIPTION
     The function setuid is used to set the real user ID and
     effective user ID of the calling process.

     If the effective user ID of the calling process is super-
     user, the real user ID, the effective user ID and the saved
     set-user-ID from exec(2) are set to uid.

     If the effective user ID of the calling process is not
     super-user, then setuid behaves as follows.  If uid is equal
     to the real user ID of the current process or if uid is
     equal to the saved set-user-ID from exec(2), the effective
     user ID is set to uid.

     The function setgid is used to set the real group ID and
     effective group ID of the calling process.

     If the effective user ID of the calling process is super-
     user, the real group ID, the effective group ID and the
     saved set-group-ID from exec(2) are set to gid.

     If the effective user ID of the calling process is not
     super-user, then setgid behaves as follows.  If gid is equal
     to the real group ID of the current process or if gid is
     equal to the saved set-group-ID from exec(2), the effective
     group ID is set to 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
     The function setuid will fail and set errno to:

     [EPERM]        if the real user ID of the calling process is
                    not equal to uid, and the saved set-user-ID
                    from exec(2) is not equal to uid, and its
                    effective user ID is not super-user.




Page 1                        CX/UX Programmer's Reference Manual





setuid(2)                 AT&T SYSTEM V                 setuid(2)



     [EINVAL]       if the uid is out of range.

     The function setgid will fail and set errno to:

     [EPERM]        if the real group ID of the calling process
                    is not equal to gid, and the saved set-
                    group-ID from exec(2) is not equal to gid,
                    and its effective user ID is not super-user.

     [EINVAL]       The gid is out of range.

SEE ALSO
     getuid(2), setuid(3C), setreuid(2), exec(2), intro(2).










































Page 2                        CX/UX Programmer's Reference Manual



Typewritten Software • bear@typewritten.org • Edmonds, WA 98026