Commit | Line | Data |
---|---|---|
8bb980a3 C |
1 | SETUID(2) BSD Programmer's Manual SETUID(2) |
2 | ||
3 | N\bNA\bAM\bME\bE | |
4 | s\bse\bet\btu\bui\bid\bd, s\bse\bet\bte\beu\bui\bid\bd, s\bse\bet\btg\bgi\bid\bd, s\bse\bet\bte\beg\bgi\bid\bd, - set user and group ID | |
5 | ||
6 | S\bSY\bYN\bNO\bOP\bPS\bSI\bIS\bS | |
7 | #\b#i\bin\bnc\bcl\blu\bud\bde\be <\b<s\bsy\bys\bs/\b/t\bty\byp\bpe\bes\bs.\b.h\bh>\b> | |
8 | #\b#i\bin\bnc\bcl\blu\bud\bde\be <\b<u\bun\bni\bis\bst\btd\bd.\b.h\bh>\b> | |
9 | ||
10 | _\bi_\bn_\bt | |
11 | s\bse\bet\btu\bui\bid\bd(_\bu_\bi_\bd_\b__\bt _\bu_\bi_\bd); | |
12 | ||
13 | _\bi_\bn_\bt | |
14 | s\bse\bet\bte\beu\bui\bid\bd(_\bu_\bi_\bd_\b__\bt _\be_\bu_\bi_\bd); | |
15 | ||
16 | _\bi_\bn_\bt | |
17 | s\bse\bet\btg\bgi\bid\bd(_\bg_\bi_\bd_\b__\bt _\bg_\bi_\bd); | |
18 | ||
19 | _\bi_\bn_\bt | |
20 | s\bse\bet\bte\beg\bgi\bid\bd(_\bg_\bi_\bd_\b__\bt _\be_\bg_\bi_\bd); | |
21 | ||
22 | D\bDE\bES\bSC\bCR\bRI\bIP\bPT\bTI\bIO\bON\bN | |
23 | The s\bse\bet\btu\bui\bid\bd() function sets the real and effective user IDs and the saved | |
24 | set-user-ID of the current process to the specified value. The s\bse\bet\btu\bui\bid\bd() | |
25 | function is permitted if the specified ID is equal to the real user ID of | |
26 | the process, or if the effective user ID is that of the super user. | |
27 | ||
28 | The s\bse\bet\btg\bgi\bid\bd() function sets the real and effective group IDs and the saved | |
29 | set-group-ID of the current process to the specified value. The s\bse\bet\btg\bgi\bid\bd() | |
30 | function is permitted if the specified ID is equal to the real group ID | |
31 | of the process, or if the effective user ID is that of the super user. | |
32 | ||
33 | The s\bse\bet\bte\beu\bui\bid\bd() function (s\bse\bet\bte\beg\bgi\bid\bd()) sets the effective user ID (group ID) | |
34 | of the current process. The effective user ID may be set to the value of | |
35 | the real user ID or the saved set-user-ID (see intro(2) and execve(2)); | |
36 | in this way, the effective user ID of a set-user-ID executable may be | |
37 | toggled by switching to the real user ID, then re-enabled by reverting to | |
38 | the set-user-ID value. Similarly, the effective group ID may be set to | |
39 | the value of the real group ID or the saved set-user-ID. | |
40 | ||
41 | R\bRE\bET\bTU\bUR\bRN\bN V\bVA\bAL\bLU\bUE\bES\bS | |
42 | Upon success, these functions return 0; otherwise -1 is returned. | |
43 | ||
44 | If the user is not the super user, or the uid specified is not the real, | |
45 | effective ID, or saved ID, these functions return -1. | |
46 | ||
47 | S\bSE\bEE\bE A\bAL\bLS\bSO\bO | |
48 | getuid(2), getgid(2) | |
49 | ||
50 | S\bST\bTA\bAN\bND\bDA\bAR\bRD\bDS\bS | |
51 | The s\bse\bet\btu\bui\bid\bd() and s\bse\bet\btg\bgi\bid\bd() functions are compliant with the IEEE | |
52 | Std1003.1-1988 (``POSIX'') specification with _POSIX_SAVED_IDS not de- | |
53 | fined. The s\bse\bet\bte\beu\bui\bid\bd() and s\bse\bet\bte\beg\bgi\bid\bd() functions are extensions based on the | |
54 | POSIX concept of _POSIX_SAVED_IDS, and have been proposed for a future | |
55 | revision of the standard. | |
56 | ||
57 | 4.2 Berkeley Distribution June 4, 1993 1 |