OSDN Git Service

dcf9efcfbdea6eda5e4dec82d3a5ea5cbdf8c117
[linuxjm/LDP_man-pages.git] / 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 2010-09-20 "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 .RS 4
84 .ad l
85 _BSD_SOURCE || _XOPEN_SOURCE\ >=\ 500 ||
86 _XOPEN_SOURCE\ &&\ _XOPEN_SOURCE_EXTENDED
87 .ad
88 .RE
89 .\"O .SH DESCRIPTION
90 .SH 説明
91 .\"O .BR setreuid ()
92 .\"O sets real and effective user IDs of the calling process.
93 .BR setreuid ()
94 は呼び出し元のプロセスの実 (real) ユーザー ID と
95 実効 (effective) ユーザー ID を設定する。
96
97 .\"O Supplying a value of \-1 for either the real or effective user ID forces
98 .\"O the system to leave that ID unchanged.
99 実ユーザー ID や実効ユーザー ID に \-1 を与えた場合、
100 システムはその ID を変更しない。
101
102 .\"O Unprivileged processes may only set the effective user ID to the real user ID,
103 .\"O the effective user ID, or the saved set-user-ID.
104 非特権プロセスは実効ユーザー ID を実ユーザー ID または実効ユーザー ID または
105 保存 set-user-ID にしか設定できない。
106
107 .\"O Unprivileged users may only set the real user ID to
108 .\"O the real user ID or the effective user ID.
109 非特権ユーザーは、実ユーザー ID を実ユーザー ID または
110 実効ユーザー ID にしか設定できない。
111
112 .\"O If the real user ID is set or the effective user ID is set to a value
113 .\"O not equal to the previous real user ID,
114 .\"O the saved set-user-ID will be set to the new effective user ID.
115 実ユーザーID が設定されたり、実効ユーザーID が前の実ユーザーID と
116 異った値に設定された場合、保存 set-user-ID には新しい実効ユーザーID
117 の値が設定される。
118
119 .\"O Completely analogously,
120 .\"O .BR setregid ()
121 .\"O sets real and effective group ID's of the calling process,
122 .\"O and all of the above holds with "group" instead of "user".
123 これと全く同様に、
124 .BR setregid ()
125 は呼び出し元のプロセスの実グループ ID と実効グループ ID を設定し、
126 上記の説明で「ユーザー」を「グループ」に読み替えたことが成り立つ。
127 .\"O .SH "RETURN VALUE"
128 .SH 返り値
129 .\"O On success, zero is returned.
130 .\"O On error, \-1 is returned, and
131 .\"O .I errno
132 .\"O is set appropriately.
133 成功した場合は 0 が返される。エラーの場合は \-1 が返され、
134 .I errno
135 が適切に設定される。
136 .\"O .SH ERRORS
137 .SH エラー
138 .TP
139 .B EPERM
140 .\"O The calling process is not privileged
141 .\"O (Linux: does not have the
142 .\"O .B CAP_SETUID
143 .\"O capability in the case of
144 .\"O .BR setreuid (),
145 .\"O or the
146 .\"O .B CAP_SETGID
147 .\"O capability in the case of
148 .\"O .BR setregid ())
149 .\"O and a change other than (i)
150 .\"O swapping the effective user (group) ID with the real user (group) ID,
151 .\"O or (ii) setting one to the value of the other or (iii) setting the
152 .\"O effective user (group) ID to the value of the
153 .\"O saved set-user-ID (saved set-group-ID) was specified.
154 呼び出し元のプロセスに特権がなく
155 (Linux では
156 .BR setreuid ()
157 の場合に
158 .B CAP_SETUID
159 ケーパビリティ (capability) がなく、
160 .BR setregid ()
161 の場合に
162 .B CAP_SETGID
163 ケーパビリティがない)、
164 以下のいずれでもない変更が指定された:
165 (i) 実効ユーザー (グループ) ID と実ユーザー (グループ) ID を入れ換える。
166 (ii) 片方の値を他方に設定する。
167 (iii) 実効ユーザー (グループ) ID に保存 set-user-ID (保存 set-group-ID)
168 の値を設定する。
169 .\"O .SH "CONFORMING TO"
170 .SH 準拠
171 .\"O POSIX.1-2001, 4.3BSD (the
172 .\"O .BR setreuid ()
173 .\"O and
174 .\"O .BR setregid ()
175 .\"O function calls first appeared in 4.2BSD).
176 POSIX.1-2001, 4.3BSD
177 .RB ( setreuid ()
178
179 .BR setregid ()
180 関数コールは 4.2BSD で登場した)。
181 .\"O .SH NOTES
182 .SH 注意
183 .\"O Setting the effective user (group) ID to the
184 .\"O saved set-user-ID (saved set-group-ID) is
185 .\"O possible since Linux 1.1.37 (1.1.38).
186 実効ユーザー (グループ) ID を保存ユーザー (グループ) ID に
187 設定することが、Linux 1.1.37 (1.1.38) から可能になった。
188
189 .\"O POSIX.1 does not specify all of possible ID changes that are permitted
190 .\"O on Linux for an unprivileged process.
191 POSIX.1 では、非特権プロセスに対して Linux 上で認められている ID の変更の
192 全パターンを規定しているわけではない。
193 .\"O For
194 .\"O .BR setreuid (),
195 .\"O the effective user ID can be made the same as the
196 .\"O real user ID or the save set-user-ID,
197 .\"O and it is unspecified whether unprivileged processes may set the
198 .\"O real user ID to the real user ID, the effective user ID, or the
199 .\"O saved set-user-ID.
200 .BR setreuid ()
201 では、実効ユーザ ID を実ユーザ ID もしくは保存 set-user-ID と
202 同じ値にすることができるが、
203 非特権プロセスが実ユーザ ID を実ユーザ ID、実効ユーザ ID、
204 保存 set-user-ID のどの値にも設定できるかは規定されていない。
205 .\"O For
206 .\"O .BR setregid (),
207 .\"O the real group ID can be changed to the value of the saved set-group-ID,
208 .\"O and the effective group ID can be changed to the value of
209 .\"O the real group ID or the saved set-group-ID.
210 .BR setregid ()
211 では、実グループ ID を保存 set-group-ID と同じ値に変更でき、
212 実効グループ ID を実グループ ID や保存 set-group-ID と同じ値に変更できる。
213 .\"O The precise details of what ID changes are permitted vary
214 .\"O across implementations.
215 どのような ID の変更が認められているかの正確な詳細は
216 実装ごとに異なる。
217
218 .\"O POSIX.1 makes no specification about the effect of these calls
219 .\"O on the saved set-user-ID and saved set-group-ID.
220 POSIX.1 では、これらのシステムコールが保存 set-user-ID や
221 保存 set-group-ID に与える影響については規定していない。
222 .\"O .SH "SEE ALSO"
223 .SH 関連項目
224 .BR getgid (2),
225 .BR getuid (2),
226 .BR seteuid (2),
227 .BR setgid (2),
228 .BR setresuid (2),
229 .BR setuid (2),
230 .BR capabilities (7)