]>
Commit | Line | Data |
---|---|---|
fea681da MK |
1 | .\" Hey Emacs! This file is -*- nroff -*- source. |
2 | .\" | |
3 | .\" Copyright (C) 1997 Andries Brouwer (aeb@cwi.nl) | |
4 | .\" | |
5 | .\" Permission is granted to make and distribute verbatim copies of this | |
6 | .\" manual provided the copyright notice and this permission notice are | |
7 | .\" preserved on all copies. | |
8 | .\" | |
9 | .\" Permission is granted to copy and distribute modified versions of this | |
10 | .\" manual under the conditions for verbatim copying, provided that the | |
11 | .\" entire resulting derived work is distributed under the terms of a | |
12 | .\" permission notice identical to this one. | |
c13182ef | 13 | .\" |
fea681da MK |
14 | .\" Since the Linux kernel and libraries are constantly changing, this |
15 | .\" manual page may be incorrect or out-of-date. The author(s) assume no | |
16 | .\" responsibility for errors or omissions, or for damages resulting from | |
17 | .\" the use of the information contained herein. The author(s) may not | |
18 | .\" have taken the same level of care in the production of this manual, | |
19 | .\" which is licensed free of charge, as they might when working | |
20 | .\" professionally. | |
c13182ef | 21 | .\" |
fea681da MK |
22 | .\" Formatted or processed versions of this manual, if unaccompanied by |
23 | .\" the source, must acknowledge the copyright and authors of this work. | |
24 | .\" | |
c11b1abf | 25 | .\" Modified, 2003-05-26, Michael Kerrisk, <mtk.manpages@gmail.com> |
cc4615cc | 26 | .TH SETRESUID 2 2007-07-26 "Linux" "Linux Programmer's Manual" |
fea681da MK |
27 | .SH NAME |
28 | setresuid, setresgid \- set real, effective and saved user or group ID | |
29 | .SH SYNOPSIS | |
30 | .B #define _GNU_SOURCE | |
31 | .br | |
32 | .B #include <unistd.h> | |
33 | .sp | |
34 | .BI "int setresuid(uid_t " ruid ", uid_t " euid ", uid_t " suid ); | |
35 | .br | |
c13182ef | 36 | .BI "int setresgid(gid_t " rgid ", gid_t " egid ", gid_t " sgid ); |
fea681da | 37 | .SH DESCRIPTION |
e511ffb6 | 38 | .BR setresuid () |
d9df8ff8 | 39 | sets the real user ID, the effective user ID, and the |
a1ffe9f5 | 40 | saved set-user-ID of the calling process. |
fea681da | 41 | |
d9df8ff8 MK |
42 | Unprivileged user processes |
43 | may change the real UID, | |
44 | effective UID, and saved set-user-ID, each to one of: | |
c13182ef | 45 | the current real UID, the current effective UID or the |
d9df8ff8 | 46 | current saved set-user-ID. |
fea681da | 47 | |
0b9bdf82 | 48 | Privileged processes (on Linux, those having the \fBCAP_SETUID\fP capability) |
c13182ef | 49 | may set the real UID, effective UID, and |
d9df8ff8 | 50 | saved set-user-ID to arbitrary values. |
fea681da | 51 | |
c4bb193f | 52 | If one of the arguments equals \-1, the corresponding value is not changed. |
fea681da | 53 | |
bb40bc01 | 54 | Regardless of what changes are made to the real UID, effective UID, |
c13182ef | 55 | and saved set-user-ID, the file system UID is always set to the same |
bb40bc01 MK |
56 | value as the (possibly new) effective UID. |
57 | ||
fea681da | 58 | Completely analogously, |
e511ffb6 | 59 | .BR setresgid () |
c13182ef | 60 | sets the real GID, effective GID, and saved set-group-ID |
a1ffe9f5 | 61 | of the calling process (and always modifies the file system GID |
bb40bc01 | 62 | to be the same as the effective GID), |
d9df8ff8 | 63 | with the same restrictions for non-privileged processes. |
fea681da | 64 | .SH "RETURN VALUE" |
c13182ef MK |
65 | On success, zero is returned. |
66 | On error, \-1 is returned, and | |
fea681da MK |
67 | .I errno |
68 | is set appropriately. | |
69 | .SH ERRORS | |
70 | .TP | |
71 | .B EAGAIN | |
72 | .I uid | |
d9df8ff8 | 73 | does not match the current UID and this call would |
2f0af33b | 74 | bring that user ID over its |
0daa9e92 | 75 | .B RLIMIT_NPROC |
2f0af33b | 76 | resource limit. |
fea681da MK |
77 | .TP |
78 | .B EPERM | |
0b9bdf82 | 79 | The calling process is not privileged (did not have the \fBCAP_SETUID\fP |
d3c8b3e9 | 80 | capability) and tried to change the IDs to values that are not permitted. |
a1d5f77c MK |
81 | .SH VERSIONS |
82 | These calls are available under Linux since Linux 2.1.44. | |
fea681da | 83 | .SH "CONFORMING TO" |
c13182ef | 84 | These calls are non-standard; |
97c1eac8 | 85 | they also appear on HP-UX and some of the BSDs. |
fea681da MK |
86 | .SH NOTES |
87 | Under HP-UX and FreeBSD the prototype is found in | |
88 | .IR <unistd.h> . | |
cc4615cc | 89 | Under Linux the prototype is provided by glibc since version 2.3.2. |
fea681da MK |
90 | .SH "SEE ALSO" |
91 | .BR getresuid (2), | |
92 | .BR getuid (2), | |
bb40bc01 MK |
93 | .BR setfsuid (2), |
94 | .BR setfsgid (2), | |
fea681da MK |
95 | .BR setreuid (2), |
96 | .BR setuid (2), | |
0a90178c | 97 | .BR capabilities (7), |
53a1443c | 98 | .BR credentials (7), |
0a90178c | 99 | .BR feature_test_macros (7) |