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

NAME

6       setresuid, setresgid - set real, effective and saved user or group ID
7

SYNOPSIS

9       #define _GNU_SOURCE
10       #include <unistd.h>
11
12       int setresuid(uid_t ruid, uid_t euid, uid_t suid);
13       int setresgid(gid_t rgid, gid_t egid, gid_t sgid);
14

DESCRIPTION

16       setresuid() sets the real user ID, the effective user ID, and the saved
17       set-user-ID of the current process.
18
19       Unprivileged user processes may change the real UID, effective UID, and
20       saved  set-user-ID,  each  to one of: the current real UID, the current
21       effective UID or the current saved set-user-ID.
22
23       Privileged processes (on Linux, those having the CAP_SETUID capability)
24       may set the real UID, effective UID, and saved set-user-ID to arbitrary
25       values.
26
27       If one of the parameters equals -1,  the  corresponding  value  is  not
28       changed.
29
30       Regardless of what changes are made to the real UID, effective UID, and
31       saved set-user-ID, the file system UID is always set to the same  value
32       as the (possibly new) effective UID.
33
34       Completely  analogously,  setresgid() sets the real GID, effective GID,
35       and saved set-group-ID of the current process (and always modifies  the
36       file  system  GID  to  be the same as the effective GID), with the same
37       restrictions for non-privileged processes.
38
39

RETURN VALUE

41       On success, zero is returned.  On error, -1 is returned, and  errno  is
42       set appropriately.
43

ERRORS

45       EAGAIN uid  does  not  match  the current UID and this call would bring
46              that user ID over its NPROC rlimit.
47
48       EPERM  The  calling  process  is  not  privileged  (did  not  have  the
49              CAP_SETUID  capability)  and  tried  to change the IDs to values
50              that are not permitted.
51

CONFORMING TO

53       These calls are non-standard; they also appear on HP-UX and some of the
54       BSDs.
55

HISTORY

57       This  system call was first introduced in HP-UX.  It is available under
58       Linux since Linux 2.1.44.  These days it is also found in FreeBSD  (for
59       emulation of Linux binaries).
60

NOTES

62       Under  HP-UX  and  FreeBSD the prototype is found in <unistd.h>.  Under
63       Linux the prototype is given by  glibc  since  version  2.3.2  provided
64       _GNU_SOURCE is defined.
65

SEE ALSO

67       getresuid(2),   getuid(2),   setfsuid(2),   setfsgid(2),   setreuid(2),
68       setuid(2), capabilities(7), feature_test_macros(7)
69
70
71
72Linux 2.4                         2003-05-26                      SETRESUID(2)
Impressum