1 .\" Hey Emacs! This file is -*- nroff -*- source.
3 .\" Copyright (C) 1997 Andries Brouwer (aeb@cwi.nl)
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.
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.
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
22 .\" Formatted or processed versions of this manual, if unaccompanied by
23 .\" the source, must acknowledge the copyright and authors of this work.
25 .\" Modified, 2003-05-26, Michael Kerrisk, <mtk.manpages@gmail.com>
27 .\" Japanese Version Copyright (c) 1997 HANATAKA Shinya
28 .\" all rights reserved.
29 .\" Translated 1997-08-30, HANATAKA Shinya <hanataka@abyss.rim.or.jp>
30 .\" Updated & Modified 2004-05-22, Yuichi SATO <ysato444@yahoo.co.jp>
31 .\" Updated & Modified 2005-01-04, Yuichi SATO
32 .\" Updated & Modified 2005-09-03, Akihiro MOTOKI <amotoki@dd.iij4u.or.jp>
33 .\" Updated & Modified 2005-11-04, Akihiro MOTOKI <amotoki@dd.iij4u.or.jp>
35 .\"WORD: effective user ID ¼Â¸ú¥æ¡¼¥¶¡¼ID
36 .\"WORD: real user ID ¼Â¥æ¡¼¥¶¡¼ID
37 .\"WORD: saved set-user-ID Êݸ¥»¥Ã¥È¥æ¡¼¥¶¡¼ID
38 .\"WORD: effective group ID ¼Â¸ú¥°¥ë¡¼¥×ID
39 .\"WORD: real group ID ¼Â¥°¥ë¡¼¥×ID
40 .\"WORD: saved group ID Êݸ¥°¥ë¡¼¥×ID
42 .TH SETRESUID 2 2007-07-26 "Linux" "Linux Programmer's Manual"
45 .\"O setresuid, setresgid \- set real, effective and saved user or group ID
46 setresuid, setresgid \- ¥æ¡¼¥¶¤ä¥°¥ë¡¼¥×¤Î ¼Â¡¢¼Â¸ú¡¢Êݸ ID ¤òÀßÄꤹ¤ë
49 .B #define _GNU_SOURCE
51 .B #include <unistd.h>
53 .BI "int setresuid(uid_t " ruid ", uid_t " euid ", uid_t " suid );
55 .BI "int setresgid(gid_t " rgid ", gid_t " egid ", gid_t " sgid );
59 .\"O sets the real user ID, the effective user ID, and the
60 .\"O saved set-user-ID of the calling process.
62 ¤Ï¸Æ¤Ó½Ð¤·¸µ¤Î¥×¥í¥»¥¹¤Î¼Â (real) ¥æ¡¼¥¶¡¼ID¡¢¼Â¸ú (effective) ¥æ¡¼¥¶¡¼ID¡¢
63 Êݸ set-user-ID ¤òÀßÄꤹ¤ë¡£
65 .\"O Unprivileged user processes
66 .\"O may change the real UID,
67 .\"O effective UID and saved set-user-ID, each to one of:
68 .\"O the current real UID, the current effective UID or the
69 .\"O current saved set-user-ID.
70 ÈóÆø¢¥æ¡¼¥¶¡¼¤Î¥×¥í¥»¥¹¤Ï¡¢¤½¤Î¼Â UID¡¢¼Â¸ú UID¡¢Êݸ set-user-ID ¤ò¡¢
71 ¸½ºß¤Î¼Â UID¡¢¸½ºß¤Î¼Â¸ú UID¡¢¸½ºß¤ÎÊݸ set-user-ID
72 ¤Î¤É¤ì¤«¤ËÊѹ¹¤¹¤ë¤³¤È¤¬¤Ç¤¤ë:
74 .\"O Privileged processes (on Linux, those having the \fBCAP_SETUID\fP capability)
75 .\"O may set the real UID, effective UID, and
76 .\"O saved set-user-ID to arbitrary values.
77 Æø¢¥×¥í¥»¥¹ (Linux ¤Ç¤Ï \fBCAP_SETUID\fP ¥±¡¼¥Ñ¥Ó¥ê¥Æ¥£ (capability) ¤ò»ý¤Ä
78 ¥×¥í¥»¥¹) ¤Ï¡¢¼Â UID¡¢¼Â¸ú UID¡¢Êݸ set-user-ID ¤òǤ°Õ¤ÎÃͤËÀßÄê¤Ç¤¤ë¡£
80 .\"O If one of the arguments equals \-1, the corresponding value is not changed.
81 °ú¤¿ô¤Î¤É¤ì¤«¤¬ \-1 ¤Î¾ì¹ç¤Ï¤½¤ÎÃͤÏÊѹ¹¤µ¤ì¤º¤Ë»Ä¤µ¤ì¤ë¡£
83 .\"O Regardless of what changes are made to the real UID, effective UID,
84 .\"O and saved set-user-ID, the file system UID is always set to the same
85 .\"O value as the (possibly new) effective UID.
86 ¼Â UID¡¢¼Â¸ú UID¡¢Êݸ set-user-ID ¤Ë¤É¤ó¤ÊÊѹ¹¤¬¹Ô¤ï¤ì¤¿¤«¤Ë´Ø¤ï¤é¤º¡¢
87 ¥Õ¥¡¥¤¥ë¥·¥¹¥Æ¥à UID ¤Ï¾ï¤Ë¼Â¸ú UID (²Äǽ¤Ç¤¢¤ì¤ÐÊѹ¹¸å¤Î¿·¤·¤¤¼Â¸ú UID)
88 ¤ÈƱ¤¸ÃͤËÀßÄꤵ¤ì¤ë¡£
90 .\"O Completely analogously,
92 .\"O sets the real GID, effective GID, and saved set-group-ID
93 .\"O of the calling process (and always modifies the file system GID
94 .\"O to be the same as the effective GID),
95 .\"O with the same restrictions for unprivileged processes.
98 ¤Ï¸Æ¤Ó½Ð¤·¸µ¤Î¥×¥í¥»¥¹¤Î¼Â GID¡¢¼Â¸ú GID¡¢Êݸ set-group-ID ¤òÀßÄꤹ¤ë
99 (¤µ¤é¤Ë¥Õ¥¡¥¤¥ë¥·¥¹¥Æ¥à GID ¤ò¼Â¸ú GID ¤ÈƱ¤¸Ãͤ˽¤Àµ¤¹¤ë)¡£
100 ÈóÆø¢¥×¥í¥»¥¹¤ÏƱÍͤÎÀ©¸Â¤ò¼õ¤±¤ë¡£
101 .\"O .SH "RETURN VALUE"
103 .\"O On success, zero is returned.
104 .\"O On error, \-1 is returned, and
106 .\"O is set appropriately.
107 À®¸ù¤·¤¿¾ì¹ç¤Ï 0 ¤¬ÊÖ¤µ¤ì¤ë¡£¥¨¥é¡¼¤Î¾ì¹ç¤Ï \-1 ¤¬ÊÖ¤µ¤ì¡¢
115 .\"O does not match the current UID and this call would
116 .\"O bring that user ID over its
120 ¤¬¸½ºß¤Î¥æ¡¼¥¶¡¼ ID ¤È°ã¤¦Ãͤǡ¢
121 ¤³¤Î¸Æ¤Ó½Ð¤·¤Ë¤è¤ê ¥æ¡¼¥¶¡¼ ID ¤¬
127 .\"O The calling process is not privileged (did not have the \fBCAP_SETUID\fP
128 .\"O capability) and tried to change the IDs to values that are not permitted.
129 ¸Æ¤Ó½Ð¤·¤¿¥×¥í¥»¥¹¤¬Æø¢¤ò»ý¤¿¤Ê¤¤¤Î¤Ë
130 (\fBCAP_SETUID\fP ¥±¡¼¥Ñ¥Ó¥ê¥Æ¥£¤ò»ý¤¿¤Ê¤¤¤Î¤Ë)¡¢
131 ID ¤òµö¤µ¤ì¤Æ¤¤¤Ê¤¤ÃͤËÊѹ¹¤·¤è¤¦¤È¤·¤¿¡£
134 .\"O It is available under Linux since Linux 2.1.44.
135 Linux ¤Ç¤Ï¥Ð¡¼¥¸¥ç¥ó 2.1.44 ¤è¤êÍøÍѲÄǽ¤Ë¤Ê¤Ã¤¿¡£
136 .\"O .SH "CONFORMING TO"
138 .\"O These calls are nonstandard;
139 .\"O they also appear on HP-UX and some of the BSDs.
140 ¤³¤ì¤é¤Î¥³¡¼¥ë¤ÏÈóɸ½à¤Ç¤¢¤ë¡£
141 HP-UX ¤ä BSD ·Ï¤Î¤¤¤¯¤Ä¤«¤Ë¤â¸ºß¤¹¤ë¡£
144 .\"O Under HP-UX and FreeBSD the prototype is found in
145 .\"O .IR <unistd.h> .
146 HP-UX ¤ä FreeBSD ¤Ç¤Ï
148 ¤Ë¥×¥í¥È¥¿¥¤¥×¤¬Â¸ºß¤¹¤ë¡£
149 .\"O Under Linux the prototype is provided by glibc since version 2.3.2.
150 Linux ¤Ç¤Ï¡¢glibc 2.3.2 °Ê¹ß¤Ç
151 ¥×¥í¥È¥¿¥¤¥×¤¬Ä󶡤µ¤ì¤Æ¤¤¤ë¡£
160 .BR capabilities (7),
162 .BR feature_test_macros (7)