version 1, including all changes.
.
Rev |
Author |
# |
Line |
1 |
perry |
1 |
SETREUID |
|
|
2 |
!!!SETREUID |
|
|
3 |
NAME |
|
|
4 |
SYNOPSIS |
|
|
5 |
DESCRIPTION |
|
|
6 |
RETURN VALUE |
|
|
7 |
ERRORS |
|
|
8 |
NOTES |
|
|
9 |
CONFORMING TO |
|
|
10 |
SEE ALSO |
|
|
11 |
---- |
|
|
12 |
!!NAME |
|
|
13 |
|
|
|
14 |
|
|
|
15 |
setreuid, setregid - set real and/or effective user or group ID |
|
|
16 |
!!SYNOPSIS |
|
|
17 |
|
|
|
18 |
|
|
|
19 |
__#include __ |
|
|
20 |
#include __ |
|
|
21 |
|
|
|
22 |
|
|
|
23 |
__int setreuid(uid_t__ ''ruid''__, uid_t__ |
|
|
24 |
''euid''__); |
|
|
25 |
int setregid(gid_t__ ''rgid''__, gid_t__ |
|
|
26 |
''egid''__);__ |
|
|
27 |
!!DESCRIPTION |
|
|
28 |
|
|
|
29 |
|
|
|
30 |
__setreuid__ sets real and effective user IDs of the |
|
|
31 |
current process. Unprivileged users may only set the real |
|
|
32 |
user ID to the real user ID or the effective user ID, and |
|
|
33 |
may only set the effective user ID to the real user ID, the |
|
|
34 |
effective user ID or the saved user ID. |
|
|
35 |
|
|
|
36 |
|
|
|
37 |
Supplying a value of -1 for either the real or effective |
|
|
38 |
user ID forces the system to leave that ID |
|
|
39 |
unchanged. |
|
|
40 |
|
|
|
41 |
|
|
|
42 |
If the real user ID is set or the effective user ID is set |
|
|
43 |
to a value not equal to the previous real user ID, the saved |
|
|
44 |
user ID will be set to the new effective user |
|
|
45 |
ID. |
|
|
46 |
|
|
|
47 |
|
|
|
48 |
Completely analogously, __setregid__ sets real and |
|
|
49 |
effective group ID's of the current process, and all of the |
|
|
50 |
above holds with |
|
|
51 |
__ |
|
|
52 |
!!RETURN VALUE |
|
|
53 |
|
|
|
54 |
|
|
|
55 |
On success, zero is returned. On error, -1 is returned, and |
|
|
56 |
''errno'' is set appropriately. |
|
|
57 |
!!ERRORS |
|
|
58 |
|
|
|
59 |
|
|
|
60 |
__EPERM__ |
|
|
61 |
|
|
|
62 |
|
|
|
63 |
The current process is not the super-user and changes other |
|
|
64 |
than (i) swapping the effective user (group) ID with the |
|
|
65 |
real user (group) ID, or (ii) setting one to the value of |
|
|
66 |
the other or (iii) setting the effective user (group) ID to |
|
|
67 |
the value of the saved user (group) ID was |
|
|
68 |
specified. |
|
|
69 |
!!NOTES |
|
|
70 |
|
|
|
71 |
|
|
|
72 |
Setting the effective user (group) ID to the saved user ID |
|
|
73 |
is possible since Linux 1.1.37 (1.1.38). |
|
|
74 |
!!CONFORMING TO |
|
|
75 |
|
|
|
76 |
|
|
|
77 |
BSD 4.3 (the __setreuid__ and __setregid__ function |
|
|
78 |
calls first appeared in 4.2BSD). |
|
|
79 |
!!SEE ALSO |
|
|
80 |
|
|
|
81 |
|
|
|
82 |
getuid(2), getgid(2), setuid(2), |
|
|
83 |
setgid(2), seteuid(2), |
|
|
84 |
setresuid(2) |
|
|
85 |
---- |