1SETEGID(2)                 Linux Programmer's Manual                SETEGID(2)
2
3
4

NAME

6       seteuid, setegid - set effective user or group ID
7

SYNOPSIS

9       #include <sys/types.h>
10       #include <unistd.h>
11
12       int seteuid(uid_t euid);
13       int setegid(gid_t egid);
14

DESCRIPTION

16       seteuid()  sets the effective user ID of the current process.  Unprivi‐
17       leged user processes may only set the effective user  ID  to  the  real
18       user ID, the effective user ID or the saved set-user-ID.
19
20       Precisely the same holds for setegid() with "group" instead of "user".
21
22

RETURN VALUE

24       On  success,  zero is returned.  On error, -1 is returned, and errno is
25       set appropriately.
26

ERRORS

28       EPERM  The current process is not privileged (Linux: does not have  the
29              CAP_SETUID  capability in the case of seteuid(), or the CAP_SET‐
30              GID capability in the case of setegid()) and euid (resp.   egid)
31              is  not the real user (group) ID, the effective user (group) ID,
32              or the saved set-user-ID (saved set-group-ID).
33

NOTES

35       Setting the effective user (group) ID to the saved  set-user-ID  (saved
36       set-group-ID) is possible since Linux 1.1.37 (1.1.38).  On an arbitrary
37       system one should check _POSIX_SAVED_IDS.
38
39       Under  libc4,  libc5  and  glibc2.0  seteuid(euid)  is  equivalent   to
40       setreuid(-1,  euid)  and hence may change the saved set-user-ID.  Under
41       glibc2.1 it is equivalent to setresuid(-1, euid,-1) and hence does  not
42       change the saved set-user-ID.  Similar remarks hold for setegid().
43

CONFORMING TO

45       4.3BSD, POSIX.1-2001.
46

SEE ALSO

48       geteuid(2), setresuid(2), setreuid(2), setuid(2), capabilities(7)
49
50
51
52Linux 2.6.6                       2004-05-27                        SETEGID(2)
Impressum