OSDN Git Service

091ba7d8ef712a02e8d3c2923abbcae35ca0eb47
[linuxjm/LDP_man-pages.git] / draft / man2 / seteuid.2
1 .\" Copyright (C) 2001 Andries Brouwer (aeb@cwi.nl)
2 .\"
3 .\" Permission is granted to make and distribute verbatim copies of this
4 .\" manual provided the copyright notice and this permission notice are
5 .\" preserved on all copies.
6 .\"
7 .\" Permission is granted to copy and distribute modified versions of this
8 .\" manual under the conditions for verbatim copying, provided that the
9 .\" entire resulting derived work is distributed under the terms of a
10 .\" permission notice identical to this one.
11 .\"
12 .\" Since the Linux kernel and libraries are constantly changing, this
13 .\" manual page may be incorrect or out-of-date.  The author(s) assume no
14 .\" responsibility for errors or omissions, or for damages resulting from
15 .\" the use of the information contained herein.  The author(s) may not
16 .\" have taken the same level of care in the production of this manual,
17 .\" which is licensed free of charge, as they might when working
18 .\" professionally.
19 .\"
20 .\" Formatted or processed versions of this manual, if unaccompanied by
21 .\" the source, must acknowledge the copyright and authors of this work.
22 .\"
23 .\" [should really be seteuid.3]
24 .\" Modified, 27 May 2004, Michael Kerrisk <mtk.manpages@gmail.com>
25 .\"     Added notes on capability requirements
26 .\"
27 .\" Japanese Version Copyright (c) 2001, 2005 Yuichi SATO
28 .\"         all rights reserved.
29 .\" Translated 2001-06-04, Yuichi SATO <ysato@h4.dion.ne.jp>
30 .\" Updated & Modified 2005-01-04, Yuichi SATO <ysato444@yahoo.co.jp>
31 .\" Updated 2010-04-23, Akihiro MOTOKI <amotoki@dd.iij4u.or.jp>, LDP v3.24
32 .\"
33 .\"WORD:        effective user ID       実効ユーザー ID
34 .\"WORD:        real user ID            実ユーザー ID
35 .\"WORD:        saved user ID           保存ユーザー ID
36 .\"WORD:
37 .\"
38 .TH SETEUID 2 2009-10-17 "Linux" "Linux Programmer's Manual"
39 .\"O .SH NAME
40 .SH 名前
41 .\"O seteuid, setegid \- set effective user or group ID
42 seteuid, setegid \- 実効ユーザー ID や 実効グループ ID を設定する
43 .\"O .SH SYNOPSIS
44 .SH 書式
45 .B #include <sys/types.h>
46 .br
47 .B #include <unistd.h>
48 .sp
49 .BI "int seteuid(uid_t " euid );
50 .br
51 .BI "int setegid(gid_t " egid );
52 .sp
53 .in -4n
54 .\"O Feature Test Macro Requirements for glibc (see
55 .\"O .BR feature_test_macros (7)):
56 glibc 向けの機能検査マクロの要件
57 .RB ( feature_test_macros (7)
58 参照):
59 .in
60 .sp
61 .ad l
62 .BR seteuid (),
63 .BR setegid ():
64 .RS 4
65 _BSD_SOURCE || _POSIX_C_SOURCE\ >=\ 200112L || _XOPEN_SOURCE\ >=\ 600
66 .RE
67 .ad
68 .\"O .SH DESCRIPTION
69 .SH 説明
70 .\"O .BR seteuid ()
71 .\"O sets the effective user ID of the calling process.
72 .\"O Unprivileged user processes may only set the effective user ID to the
73 .\"O real user ID, the effective user ID or the saved set-user-ID.
74 .BR seteuid ()
75 は呼び出し元のプロセスの実効ユーザー ID を設定する。
76 非特権ユーザーのプロセスの場合、実効ユーザー ID に設定できるのは、
77 実ユーザー ID・実効ユーザー ID・保存 set-user-ID のいずれかだけである。
78
79 .\"O Precisely the same holds for
80 .\"O .BR setegid ()
81 .\"O with "group" instead of "user".
82 .BR setegid ()
83 は「ユーザー」ではなく「グループ」に対して全く同じことを行う。
84 .\" When
85 .\" .I euid
86 .\" equals \-1, nothing is changed.
87 .\" (This is an artifact of the implementation in glibc of seteuid()
88 .\" using setresuid(2).)
89 .\"O .SH "RETURN VALUE"
90 .SH 返り値
91 .\"O On success, zero is returned.
92 .\"O On error, \-1 is returned, and
93 .\"O .I errno
94 .\"O is set appropriately.
95 成功した場合は 0 が返される。
96 エラーの場合は \-1 が返され、
97 .I errno
98 が適切に設定される。
99
100 .\"O .SH ERRORS
101 .SH エラー
102 .\" .TP
103 .\" .B EINVAL
104 .TP
105 .B EPERM
106 .\"O The calling process is not privileged (Linux: does not have the
107 .\"O .B CAP_SETUID
108 .\"O capability in the case of
109 .\"O .BR seteuid (),
110 .\"O or the
111 .\"O .B CAP_SETGID
112 .\"O capability in the case of
113 .\"O .BR setegid ())
114 .\"O and
115 .\"O .I euid
116 .\"O (respectively,
117 .\"O .IR egid )
118 .\"O is not the real user (group) ID, the effective user (group) ID,
119 .\"O or the saved set-user-ID (saved set-group-ID).
120 呼び出し元のプロセスに特権がなく、
121 .I euid
122 .RI ( egid )
123 が実ユーザー (グループ) ID、または実効ユーザー (グループ) ID、
124 保存 set-user-ID (保存 set-group-ID) のいずれでもではない
125 (Linux においては、
126 .BR seteuid ()
127 では
128 .B CAP_SETUID
129 ケーパビリティ (capability) が、
130 .BR setegid ()
131 では
132 .B CAP_SETGID
133 ケーパビリティがない場合に、特権がないと判断される)。
134 .\"O .SH "CONFORMING TO"
135 .SH 準拠
136 4.3BSD, POSIX.1-2001.
137 .\"O .SH NOTES
138 .SH 注意
139 .\"O Setting the effective user (group) ID to the
140 .\"O saved set-user-ID (set-group-ID) is
141 .\"O possible since Linux 1.1.37 (1.1.38).
142 .\"O On an arbitrary system one should check
143 .\"O .BR _POSIX_SAVED_IDS .
144 実効ユーザー (グループ) ID を保存 set-user-ID (保存 set-group-ID) に
145 設定できるのは、Linux 1.1.37 (1.1.38) 以降である。
146 全てのシステムにおいて
147 .B _POSIX_SAVED_IDS
148 をチェックすべきである。
149 .LP
150 .\"O Under libc4, libc5 and glibc 2.0
151 .\"O .BI seteuid( euid )
152 .\"O is equivalent to
153 .\"O .BI setreuid(\-1, " euid" )
154 .\"O and hence may change the saved set-user-ID.
155 .\"O Under glibc 2.1 it is equivalent to
156 .\"O .BI setresuid(\-1, " euid" ", \-1)"
157 .\"O and hence does not change the saved set-user-ID.
158 .\"O Similar remarks hold for
159 .\"O .BR setegid ().
160 libc4, libc5, glibc 2.0 では、
161 .BI seteuid( euid )
162
163 .BI setreuid(\-1, " euid" )
164 と等価であり、保存 set-user-ID を変更するかもしれない。
165 glibc 2.1 では、
166 .BI setresuid(\-1, " euid" ", \-1)"
167 と等価であり、保存 set-user-ID 変更しない。
168 同様のことが
169 .BR setegid ()
170 にも言える。
171
172 .\"O According to POSIX.1,
173 .\"O .BR seteuid ()
174 .\"O .RB ( setegid ())
175 .\"O need not permit
176 .\"O .I euid
177 .\"O .RI ( egid )
178 .\"O to be the same value as the current effective user (group) ID,
179 .\"O and some implementations do not permit this.
180 POSIX.1 では、
181 .BR seteuid ()
182 .RB ( setegid ())
183 で、
184 .I euid
185 .RI ( egid )
186 として現在の実効ユーザ (グループ) ID と同じ値を指定可能である
187 必要はないとされており、いくつかの実装では
188 .I euid
189 .RI ( egid )
190 として現在の実効ユーザ (グループ) ID と同じ値を
191 指定することができない。
192 .\"O .SH "SEE ALSO"
193 .SH 関連項目
194 .BR geteuid (2),
195 .BR setresuid (2),
196 .BR setreuid (2),
197 .BR setuid (2),
198 .BR capabilities (7),
199 .BR credentials (7)