unixdev.net


Switch to SpeakEasy.net DSL

The Modular Manual Browser

Home Page
Manual: (SunOS-4.1.3)
Page:
Section:
Apropos / Subsearch:
optional field

SETUID(3V)                                                          SETUID(3V)



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

SYNOPSIS
       #include <&lt;sys/types.h>&gt;

       int setuid(uid)
       uid_t uid;

       int seteuid(euid)
       uid_t euid;

       int setruid(ruid)
       uid_t ruid;

       int setgid(gid)
       gid_t gid;

       int setegid(egid)
       gid_t egid;

       int setrgid(rgid)
       gid_t rgid;

DESCRIPTION
       setuid() (setgid()) sets both the real and effective user ID (group ID)
       of the current process as specified by uid (gid) (see NOTES).

       seteuid() (setegid()) sets the effective user ID (group ID) of the cur-
       rent process.

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

       These  calls are only permitted to the super-user or if the argument is
       the real or effective user (group) ID of the calling process.

SYSTEM V DESCRIPTION
       If the effective user ID of the calling process is not super-user,  but
       if its real user (group) ID is equal to uid (gid), or if the saved set-
       user (group) ID from execve(2V) is equal to uid (gid), then the  effec-
       tive user (group) ID is set to uid (gid).

RETURN VALUES
       These functions return:

       0      on success.

       -1     on   failure  and  set  errno  to  indicate  the  error  as  for
              setreuid(2) (setregid(2)).

ERRORS
       EINVAL         The value of uid  (gid)  is  invalid  (less  than  0  or
                      greater than 65535).

       EPERM          The  process does not have super-user privileges and uid
                      (gid) does not matches neither the real user (group)  ID
                      of  the process nor the saved set-user-ID (set-group-ID)
                      of the process.

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

NOTES
       For setuid() to behave as described above, {_POSIX_SAVED_IDS}  must  be
       in effect (see sysconf(2V)).  {_POSIX_SAVED_IDS} is always in effect on
       SunOS systems, but for portability, applications should call  sysconf()
       to  determine  whether  {_POSIX_SAVED_IDS} is in effect for the current
       system.



                                21 January 1990                     SETUID(3V)