OSDN Git Service

Import translated manuals from JM CVS Repository.
[linuxjm/jm.git] / manual / LDP_man-pages / draft / man2 / setreuid.2
1 .\" Copyright (c) 1983, 1991 The Regents of the University of California.
2 .\" All rights reserved.
3 .\"
4 .\" Redistribution and use in source and binary forms, with or without
5 .\" modification, are permitted provided that the following conditions
6 .\" are met:
7 .\" 1. Redistributions of source code must retain the above copyright
8 .\"    notice, this list of conditions and the following disclaimer.
9 .\" 2. Redistributions in binary form must reproduce the above copyright
10 .\"    notice, this list of conditions and the following disclaimer in the
11 .\"    documentation and/or other materials provided with the distribution.
12 .\" 3. All advertising materials mentioning features or use of this software
13 .\"    must display the following acknowledgement:
14 .\"     This product includes software developed by the University of
15 .\"     California, Berkeley and its contributors.
16 .\" 4. Neither the name of the University nor the names of its contributors
17 .\"    may be used to endorse or promote products derived from this software
18 .\"    without specific prior written permission.
19 .\"
20 .\" THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
21 .\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
22 .\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
23 .\" ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
24 .\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
25 .\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
26 .\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
27 .\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
28 .\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
29 .\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
30 .\" SUCH DAMAGE.
31 .\"
32 .\"     @(#)setregid.2  6.4 (Berkeley) 3/10/91
33 .\"
34 .\" Modified Sat Jul 24 09:08:49 1993 by Rik Faith <faith@cs.unc.edu>
35 .\" Portions extracted from linux/kernel/sys.c:
36 .\"             Copyright (C) 1991, 1992  Linus Torvalds
37 .\"             May be distributed under the GNU General Public License
38 .\" Changes: 1994-07-29 by Wilf <G.Wilford@ee.surrey.ac.uk>
39 .\"          1994-08-02 by Wilf due to change in kernel.
40 .\"          2004-07-04 by aeb
41 .\"          2004-05-27 by Michael Kerrisk
42 .\"
43 .\" Japanese Version Copyright (c) 1997 HANATAKA Shinya
44 .\"         all rights reserved.
45 .\" Translated Fri Dec 12 00:18:45 JST 1997
46 .\"         by HANATAKA Shinya <hanataka@abyss.rim.or.jp>
47 .\" Updated & Modified Mon Jun  4 19:11:44 JST 2001
48 .\"         by Yuichi SATO <ysato@h4.dion.ne.jp>
49 .\" Updated & Modified Wed Jan  5 00:37:49 JST 2005
50 .\"         by Yuichi SATO <ysato444@yahoo.co.jp>
51 .\" Updated 2010-04-23, Akihiro MOTOKI <amotoki@dd.iij4u.or.jp>, LDP v3.24
52 .\"
53 .\"WORD:        effective user ID       ¼Â¸ú¥æ¡¼¥¶¡¼ID
54 .\"WORD:        real user ID            ¼Â¥æ¡¼¥¶¡¼ID
55 .\"WORD:        saved user ID           Êݸ¥æ¡¼¥¶¡¼ID
56 .\"WORD:        super-user              ¥¹¡¼¥Ñ¡¼¡¦¥æ¡¼¥¶¡¼
57 .\"
58 .TH SETREUID 2 2009-10-17 "Linux" "Linux Programmer's Manual"
59 .\"O .SH NAME
60 .SH Ì¾Á°
61 .\"O setreuid, setregid \- set real and/or effective user or group ID
62 setreuid, setregid \- ¼Â (real) ¤È¼Â¸ú (effective) ¥æ¡¼¥¶¡¼ (¥°¥ë¡¼¥×) ID ¤òÀßÄꤹ¤ë
63 .\"O .SH SYNOPSIS
64 .SH ½ñ¼°
65 .B #include <sys/types.h>
66 .br
67 .B #include <unistd.h>
68 .sp
69 .BI "int setreuid(uid_t " ruid ", uid_t " euid );
70 .br
71 .BI "int setregid(gid_t " rgid ", gid_t " egid );
72 .sp
73 .in -4n
74 .\"O Feature Test Macro Requirements for glibc (see
75 .\"O .BR feature_test_macros (7)):
76 glibc ¸þ¤±¤Îµ¡Ç½¸¡ºº¥Þ¥¯¥í¤ÎÍ×·ï
77 .RB ( feature_test_macros (7)
78 »²¾È):
79 .in
80 .sp
81 .BR setreuid (),
82 .BR setregid ():
83 _BSD_SOURCE || _XOPEN_SOURCE\ >=\ 500
84 .\"O .SH DESCRIPTION
85 .SH ÀâÌÀ
86 .\"O .BR setreuid ()
87 .\"O sets real and effective user IDs of the calling process.
88 .BR setreuid ()
89 ¤Ï¸Æ¤Ó½Ð¤·¸µ¤Î¥×¥í¥»¥¹¤Î¼Â (real) ¥æ¡¼¥¶¡¼ ID ¤È
90 ¼Â¸ú (effective) ¥æ¡¼¥¶¡¼ ID ¤òÀßÄꤹ¤ë¡£
91
92 .\"O Supplying a value of \-1 for either the real or effective user ID forces
93 .\"O the system to leave that ID unchanged.
94 ¼Â¥æ¡¼¥¶¡¼ ID ¤ä¼Â¸ú¥æ¡¼¥¶¡¼ ID ¤Ë \-1 ¤òÍ¿¤¨¤¿¾ì¹ç¡¢
95 ¥·¥¹¥Æ¥à¤Ï¤½¤Î ID ¤òÊѹ¹¤·¤Ê¤¤¡£
96
97 .\"O Unprivileged processes may only set the effective user ID to the real user ID,
98 .\"O the effective user ID, or the saved set-user-ID.
99 ÈóÆø¢¥×¥í¥»¥¹¤Ï¼Â¸ú¥æ¡¼¥¶¡¼ ID ¤ò¼Â¥æ¡¼¥¶¡¼ ID ¤Þ¤¿¤Ï¼Â¸ú¥æ¡¼¥¶¡¼ ID ¤Þ¤¿¤Ï
100 Êݸ set-user-ID ¤Ë¤·¤«ÀßÄê¤Ç¤­¤Ê¤¤¡£
101
102 .\"O Unprivileged users may only set the real user ID to
103 .\"O the real user ID or the effective user ID.
104 ÈóÆø¢¥æ¡¼¥¶¡¼¤Ï¡¢¼Â¥æ¡¼¥¶¡¼ ID ¤ò¼Â¥æ¡¼¥¶¡¼ ID ¤Þ¤¿¤Ï
105 ¼Â¸ú¥æ¡¼¥¶¡¼ ID ¤Ë¤·¤«ÀßÄê¤Ç¤­¤Ê¤¤¡£
106
107 .\"O If the real user ID is set or the effective user ID is set to a value
108 .\"O not equal to the previous real user ID,
109 .\"O the saved set-user-ID will be set to the new effective user ID.
110 ¼Â¥æ¡¼¥¶¡¼ID ¤¬ÀßÄꤵ¤ì¤¿¤ê¡¢¼Â¸ú¥æ¡¼¥¶¡¼ID ¤¬Á°¤Î¼Â¥æ¡¼¥¶¡¼ID ¤È
111 °Û¤Ã¤¿ÃͤËÀßÄꤵ¤ì¤¿¾ì¹ç¡¢Êݸ set-user-ID ¤Ë¤Ï¿·¤·¤¤¼Â¸ú¥æ¡¼¥¶¡¼ID
112 ¤ÎÃͤ¬ÀßÄꤵ¤ì¤ë¡£
113
114 .\"O Completely analogously,
115 .\"O .BR setregid ()
116 .\"O sets real and effective group ID's of the calling process,
117 .\"O and all of the above holds with "group" instead of "user".
118 ¤³¤ì¤ÈÁ´¤¯Æ±Íͤˡ¢
119 .BR setregid ()
120 ¤Ï¸Æ¤Ó½Ð¤·¸µ¤Î¥×¥í¥»¥¹¤Î¼Â¥°¥ë¡¼¥× ID ¤È¼Â¸ú¥°¥ë¡¼¥× ID ¤òÀßÄꤷ¡¢
121 ¾åµ­¤ÎÀâÌÀ¤Ç¡Ö¥æ¡¼¥¶¡¼¡×¤ò¡Ö¥°¥ë¡¼¥×¡×¤ËÆɤßÂؤ¨¤¿¤³¤È¤¬À®¤êΩ¤Ä¡£
122 .\"O .SH "RETURN VALUE"
123 .SH ÊÖ¤êÃÍ
124 .\"O On success, zero is returned.
125 .\"O On error, \-1 is returned, and
126 .\"O .I errno
127 .\"O is set appropriately.
128 À®¸ù¤·¤¿¾ì¹ç¤Ï 0 ¤¬ÊÖ¤µ¤ì¤ë¡£¥¨¥é¡¼¤Î¾ì¹ç¤Ï \-1 ¤¬ÊÖ¤µ¤ì¡¢
129 .I errno
130 ¤¬Å¬ÀÚ¤ËÀßÄꤵ¤ì¤ë¡£
131 .\"O .SH ERRORS
132 .SH ¥¨¥é¡¼
133 .TP
134 .B EPERM
135 .\"O The calling process is not privileged
136 .\"O (Linux: does not have the
137 .\"O .B CAP_SETUID
138 .\"O capability in the case of
139 .\"O .BR setreuid (),
140 .\"O or the
141 .\"O .B CAP_SETGID
142 .\"O capability in the case of
143 .\"O .BR setregid ())
144 .\"O and a change other than (i)
145 .\"O swapping the effective user (group) ID with the real user (group) ID,
146 .\"O or (ii) setting one to the value of the other or (iii) setting the
147 .\"O effective user (group) ID to the value of the
148 .\"O saved set-user-ID (saved set-group-ID) was specified.
149 ¸Æ¤Ó½Ð¤·¸µ¤Î¥×¥í¥»¥¹¤ËÆø¢¤¬¤Ê¤¯
150 (Linux ¤Ç¤Ï
151 .BR setreuid ()
152 ¤Î¾ì¹ç¤Ë
153 .B CAP_SETUID
154 ¥±¡¼¥Ñ¥Ó¥ê¥Æ¥£ (capability) ¤¬¤Ê¤¯¡¢
155 .BR setregid ()
156 ¤Î¾ì¹ç¤Ë
157 .B CAP_SETGID
158 ¥±¡¼¥Ñ¥Ó¥ê¥Æ¥£¤¬¤Ê¤¤)¡¢
159 °Ê²¼¤Î¤¤¤º¤ì¤Ç¤â¤Ê¤¤Êѹ¹¤¬»ØÄꤵ¤ì¤¿:
160 (i) ¼Â¸ú¥æ¡¼¥¶¡¼ (¥°¥ë¡¼¥×) ID ¤È¼Â¥æ¡¼¥¶¡¼ (¥°¥ë¡¼¥×) ID ¤òÆþ¤ì´¹¤¨¤ë¡£
161 (ii) ÊÒÊý¤ÎÃͤò¾Êý¤ËÀßÄꤹ¤ë¡£
162 (iii) ¼Â¸ú¥æ¡¼¥¶¡¼ (¥°¥ë¡¼¥×) ID ¤ËÊݸ set-user-ID (Êݸ set-group-ID)
163 ¤ÎÃͤòÀßÄꤹ¤ë¡£
164 .\"O .SH "CONFORMING TO"
165 .SH ½àµò
166 .\"O POSIX.1-2001, 4.3BSD (the
167 .\"O .BR setreuid ()
168 .\"O and
169 .\"O .BR setregid ()
170 .\"O function calls first appeared in 4.2BSD).
171 POSIX.1-2001, 4.3BSD
172 .RB ( setreuid ()
173 ¤È
174 .BR setregid ()
175 ´Ø¿ô¥³¡¼¥ë¤Ï 4.2BSD ¤ÇÅо줷¤¿)¡£
176 .\"O .SH NOTES
177 .SH Ãí°Õ
178 .\"O Setting the effective user (group) ID to the
179 .\"O saved set-user-ID (saved set-group-ID) is
180 .\"O possible since Linux 1.1.37 (1.1.38).
181 ¼Â¸ú¥æ¡¼¥¶¡¼ (¥°¥ë¡¼¥×) ID ¤òÊݸ¥æ¡¼¥¶¡¼ (¥°¥ë¡¼¥×) ID ¤Ë
182 ÀßÄꤹ¤ë¤³¤È¤¬¡¢Linux 1.1.37 (1.1.38) ¤«¤é²Äǽ¤Ë¤Ê¤Ã¤¿¡£
183
184 .\"O POSIX.1 does not specify all of possible ID changes that are permitted
185 .\"O on Linux for an unprivileged process.
186 POSIX.1 ¤Ç¤Ï¡¢ÈóÆø¢¥×¥í¥»¥¹¤ËÂФ·¤Æ Linux ¾å¤Çǧ¤á¤é¤ì¤Æ¤¤¤ë ID ¤ÎÊѹ¹¤Î
187 Á´¥Ñ¥¿¡¼¥ó¤òµ¬Äꤷ¤Æ¤¤¤ë¤ï¤±¤Ç¤Ï¤Ê¤¤¡£
188 .\"O For
189 .\"O .BR setreuid (),
190 .\"O the effective user ID can be made the same as the
191 .\"O real user ID or the save set-user-ID,
192 .\"O and it is unspecified whether unprivileged processes may set the
193 .\"O real user ID to the real user ID, the effective user ID, or the
194 .\"O saved set-user-ID.
195 .BR setreuid ()
196 ¤Ç¤Ï¡¢¼Â¸ú¥æ¡¼¥¶ ID ¤ò¼Â¥æ¡¼¥¶ ID ¤â¤·¤¯¤ÏÊݸ set-user-ID ¤È
197 Ʊ¤¸Ãͤˤ¹¤ë¤³¤È¤¬¤Ç¤­¤ë¤¬¡¢
198 ÈóÆø¢¥×¥í¥»¥¹¤¬¼Â¥æ¡¼¥¶ ID ¤ò¼Â¥æ¡¼¥¶ ID¡¢¼Â¸ú¥æ¡¼¥¶ ID¡¢
199 Êݸ set-user-ID ¤Î¤É¤ÎÃͤˤâÀßÄê¤Ç¤­¤ë¤«¤Ïµ¬Äꤵ¤ì¤Æ¤¤¤Ê¤¤¡£
200 .\"O For
201 .\"O .BR setregid (),
202 .\"O the real group ID can be changed to the value of the saved set-group-ID,
203 .\"O and the effective group ID can be changed to the value of
204 .\"O the real group ID or the saved set-group-ID.
205 .BR setregid ()
206 ¤Ç¤Ï¡¢¼Â¥°¥ë¡¼¥× ID ¤òÊݸ set-group-ID ¤ÈƱ¤¸ÃͤËÊѹ¹¤Ç¤­¡¢
207 ¼Â¸ú¥°¥ë¡¼¥× ID ¤ò¼Â¥°¥ë¡¼¥× ID ¤äÊݸ set-group-ID ¤ÈƱ¤¸ÃͤËÊѹ¹¤Ç¤­¤ë¡£
208 .\"O The precise details of what ID changes are permitted vary
209 .\"O across implementations.
210 ¤É¤Î¤è¤¦¤Ê ID ¤ÎÊѹ¹¤¬Ç§¤á¤é¤ì¤Æ¤¤¤ë¤«¤ÎÀµ³Î¤Ê¾ÜºÙ¤Ï
211 ¼ÂÁõ¤´¤È¤Ë°Û¤Ê¤ë¡£
212
213 .\"O POSIX.1 makes no specification about the effect of these calls
214 .\"O on the saved set-user-ID and saved set-group-ID.
215 POSIX.1 ¤Ç¤Ï¡¢¤³¤ì¤é¤Î¥·¥¹¥Æ¥à¥³¡¼¥ë¤¬Êݸ set-user-ID ¤ä
216 Êݸ set-group-ID ¤ËÍ¿¤¨¤ë±Æ¶Á¤Ë¤Ä¤¤¤Æ¤Ïµ¬Äꤷ¤Æ¤¤¤Ê¤¤¡£
217 .\"O .SH "SEE ALSO"
218 .SH ´ØÏ¢¹àÌÜ
219 .BR getgid (2),
220 .BR getuid (2),
221 .BR seteuid (2),
222 .BR setgid (2),
223 .BR setresuid (2),
224 .BR setuid (2),
225 .BR capabilities (7)