OSDN Git Service

78775b7a6a1f38801c538ffbfc1765c270e48b8d
[linuxjm/LDP_man-pages.git] / draft / man7 / credentials.7
1 .\" Copyright (c) 2007 by Michael Kerrisk <mtk.manpages@gmail.com>
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 .\" 2007-06-13 Creation
24 .\"
25 .\" Japanese Version Copyright (c) 2007 Akihiro MOTOKI all rights reserved.
26 .\" Translated 2007-10-25, Akihiro MOTOKI <amotoki@dd.iij4u.or.jp>, LDP v2.66
27 .\" Updated 2008-08-04, Akihiro MOTOKI, LDP v3.05
28 .\"
29 .TH CREDENTIALS 7 2008-06-03 "Linux" "Linux Programmer's Manual"
30 .\"O .SH NAME
31 .SH 名前
32 .\"O credentials \- process identifiers
33 credentials \- 認証に用いられるプロセスの識別子
34 .\"O .SH DESCRIPTION
35 .SH 説明
36 .\"O .SS Process ID (PID)
37 .SS プロセスID (PID)
38 .\"O Each process has a unique nonnegative integer identifier
39 .\"O that is assigned when the process is created using
40 .\"O .BR fork (2).
41 .\"O A process can obtain its PID using
42 .\"O .BR getpid (2).
43 .\"O A PID is represented using the type
44 .\"O .I pid_t
45 .\"O (defined in
46 .\"O .IR <sys/types.h> ).
47 各プロセスは、負でない整数の一意な識別子を持つ。
48 この識別子は
49 .BR fork (2)
50 を使ってプロセスが生成される際に割り当てられる。
51 プロセスは
52 .BR getpid (2)
53 を使って自分の PID を取得できる。
54 PID は
55 .I pid_t
56 型で表現される
57 .RI ( pid_t
58
59 .I <sys/types.h>
60 で定義されている)。
61
62 .\"O PIDs are used in a range of system calls to identify the process
63 .\"O affected by the call, for example:
64 PID は各種のシステムコールでそのシステムコールが作用するプロセスを
65 特定するために使用される。以下に例を挙げる:
66 .BR kill (2),
67 .BR ptrace (2),
68 .BR setpriority (2),
69 .\" .BR sched_rr_get_interval (2),
70 .\" .BR sched_getaffinity (2),
71 .\" .BR sched_setaffinity (2),
72 .\" .BR sched_getparam (2),
73 .\" .BR sched_setparam (2),
74 .\" .BR sched_setscheduler (2),
75 .\" .BR sched_getscheduler (2),
76 .BR setpgid (2),
77 .\" .BR getsid (2),
78 .BR setsid (2),
79 .BR sigqueue (3),
80 .\"O and
81 .BR waitpid (2).
82 .\" .BR waitid (2),
83 .\" .BR wait4 (2),
84
85 .\"O A process's PID is preserved across an
86 .\"O .BR execve (2).
87 プロセスの PID は
88 .BR execve (2)
89 の前後で不変である。
90 .\"O .SS Parent Process ID (PPID)
91 .SS 親プロセス ID (PPID)
92 .\"O A process's parent process ID identifies the process that created
93 .\"O this process using
94 .\"O .BR fork (2).
95 .\"O A process can obtain its PPID using
96 .\"O .BR getppid (2).
97 .\"O A PPID is represented using the type
98 .\"O .IR pid_t .
99 プロセスの親プロセスの ID は、
100 .BR fork (2)
101 を使ってそのプロセスを生成したプロセスを示す。
102 プロセスは
103 .BR getppid (2)
104 を使って自分の PPID を取得できる。
105 PPID は
106 .I pid_t
107 型で表現される。
108
109 .\"O A process's PPID is preserved across an
110 .\"O .BR execve (2).
111 プロセスの PPID は
112 .BR execve (2)
113 の前後で不変である。
114 .\"O .SS Process Group ID and Session ID
115 .SS プロセスグループ ID とセッション ID
116 .\"O Each process has a session ID and a process group ID,
117 .\"O both represented using the type
118 .\"O .IR pid_t .
119 .\"O A process can obtain its session ID using
120 .\"O .BR getsid (2),
121 .\"O and its process group ID using
122 .\"O .BR getpgrp (2).
123 各プロセスはセッション ID とプロセスグループ ID を持つ。
124 これらの ID はどちらも
125 .I pid_t
126 型で表現される。
127 プロセスは、それぞれ
128 .BR getsid (2),
129 .BR getpgrp (2)
130 を使って自分のセッション ID、プロセスグループ ID を取得できる。
131
132 .\"O A child created by
133 .\"O .BR fork (2)
134 .\"O inherits its parent's session ID and process group ID.
135 .\"O A process's session ID and process group ID are preserved across an
136 .\"O .BR execve (2).
137 .BR fork (2)
138 で生成された子プロセスは親プロセスのセッション ID とプロセスグループ ID
139 を継承する。プロセスのセッション ID とプロセスグループ ID は
140 .BR execve (2)
141 の前後で不変である。
142
143 .\"O Sessions and process groups are abstractions devised to support shell
144 .\"O job control.
145 .\"O A process group (sometimes called a "job") is a collection of
146 .\"O processes that share the same process group ID;
147 .\"O the shell creates a new process group for the process(es) used
148 .\"O to execute single command or pipeline (e.g., the two processes
149 .\"O created to execute the command "ls\ |\ wc" are placed in the
150 .\"O same process group).
151 .\"O A process's group membership can be set using
152 .\"O .BR setpgid (2).
153 .\"O The process whose process ID is the same as its process group ID is the
154 .\"O \fIprocess group leader\fP for that group.
155 セッションとプロセスグループの概念は、シェルのジョブ制御を行うために
156 考案されたものである。
157 プロセスグループ (時には「ジョブ」と呼ばれることもある) は、
158 同じプロセスグループ ID を共有するプロセスの集まりである。
159 シェルは、一つのコマンドもしくはパイプラインの実行に使われるプロセス群に
160 対して一つのプロセスグループを生成する
161 (例えば、コマンド "ls\ |\ wc" を実行するために生成される二つのプロセスは
162 同じプロセスグループに置かれる)。
163 所属するプロセスグループは
164 .BR setpgid (2)
165 を使って設定できる。
166 自身のプロセス ID がプロセスグループ ID と同じプロセスは、
167 そのグループの「プロセスグループ・リーダー」である。
168
169 .\"O A session is a collection of processes that share the same session ID.
170 .\"O All of the members of a process group also have the same session ID
171 .\"O (i.e., all of the members of a process group always belong to the
172 .\"O same session, so that sessions and process groups form a strict
173 .\"O two-level hierarchy of processes.)
174 .\"O A new session is created when a process calls
175 .\"O .BR setsid (2),
176 .\"O which creates a new session whose session ID is the same
177 .\"O as the PID of the process that called
178 .\"O .BR setsid (2).
179 .\"O The creator of the session is called the \fIsession leader\fP.
180 セッションは、同じセッション ID を共有するプロセスの集まりである。
181 ある一つのプロセスグループの全メンバーは同じセッション ID を持つ
182 (つまり、一つのプロセスグループのメンバーは全て同じセッションに所属し、
183 これにより、セッションとプロセスグループで二階層のプロセス階層が形成できる)。
184 新たなセッションの生成はプロセスが
185 .BR setsid (2)
186 を呼び出すことで行う。
187 .BR setsid (2)
188 は、
189 .BR setsid (2)
190 を呼び出したプロセスの PID と同じ値のセッション ID を持つ
191 新たなセッションを生成する。
192 セッションの生成者は「セッション・リーダー」と呼ばれる。
193 .\"O .SS User and Group Identifiers
194 .SS ユーザ ID とグループ ID
195 .\"O Each process has various associated user and groups IDs.
196 .\"O These IDs are integers, respectively represented using the types
197 .\"O .I uid_t
198 .\"O and
199 .\"O .I gid_t
200 .\"O (defined in
201 .\"O .IR <sys/types.h> ).
202 各プロセスは、数種類のユーザ ID とグループ ID を持つ。
203 ユーザ ID、グループ ID は整数で、それぞれ
204 .IR uid_t ,
205 .I gid_t
206 型で表現される (これらは
207 .I <sys/types.h>
208 で定義されている)。
209
210 .\"O On Linux, each process has the following user and group identifiers:
211 Linux では、各プロセスは以下のような種類のユーザ ID とグループ ID を持つ。
212 .IP * 3
213 .\"O Real user ID and real group ID.
214 実ユーザ ID と実グループ ID。
215 .\"O These IDs determine who owns the process.
216 .\"O A process can obtain its real user (group) ID using
217 .\"O .BR getuid (2)
218 .\"O .RB ( getgid (2)).
219 これらの ID によりプロセスの所有者が決定される。
220 プロセスが自分の実ユーザ ID、実グループ ID を取得するには、それぞれ
221 .BR getuid (2),
222 .BR getgid (2)
223 を使用する。
224 .IP *
225 .\"O Effective user ID and effective group ID.
226 実効ユーザ ID と実効グループ ID。
227 .\"O These IDs are used by the kernel to determine the permissions
228 .\"O that the process will have when accessing shared resources such
229 .\"O as message queues, shared memory, and semaphores.
230 .\"O On most UNIX systems, these IDs also determine the
231 .\"O permissions when accessing files.
232 .\"O However, Linux uses the file system IDs described below
233 .\"O for this task.
234 .\"O A process can obtain its effective user (group) ID using
235 .\"O .BR geteuid (2)
236 .\"O .RB ( getegid (2)).
237 これらの ID は、メッセージキュー、共有メモリ、セマフォなどの
238 共有リソースにアクセスしようとした際にそのプロセスがアクセス許可を
239 持っているかをカーネルが判定するのに使用される。
240 ほとんどの UNIX システムでは、これらの ID はファイルへのアクセス時の
241 アクセス許可の判定にも使用される。
242 しかしながら、Linux ではファイルへのアクセス許可の判定には
243 後述のファイルシステム ID が使用される。
244 プロセスが自分の実効ユーザ ID、実効グループ ID を取得するには、それぞれ
245 .BR geteuid (2),
246 .BR getegid (2)
247 を使用する。
248 .IP *
249 .\"O Saved set-user-ID and saved set-group-ID.
250 保存 (saved) set-user-ID と保存 set-group-ID。
251 .\"O These IDs are used in set-user-ID and set-group-ID programs to save
252 .\"O a copy of the corresponding effective IDs that were set when
253 .\"O the program was executed (see
254 .\"O .BR execve (2)).
255 これらの ID は、set-user-ID や set-group-ID されたプログラムにおいて、
256 プログラムの実行時に設定された実効 ID のコピーを保存するために
257 使用される
258 .RB ( execve (2)
259 参照)。
260 .\"O A set-user-ID program can assume and drop privileges by
261 .\"O switching its effective user ID back and forth between the values
262 .\"O in its real user ID and saved set-user-ID.
263 .\"O This switching is done via calls to
264 .\"O .BR seteuid (2),
265 .\"O .BR setreuid (2),
266 .\"O or
267 .\"O .BR setresuid (2).
268 .\"O A set-group-ID program performs the analogous tasks using
269 .\"O .BR setegid (2),
270 .\"O .BR setregid (2),
271 .\"O or
272 .\"O .BR setresgid (2).
273 set-user-ID プログラムは、実効ユーザ ID を実ユーザID と保存 set-user-ID
274 の間で行ったり来たり切り替えることで、特権を得たり落としたりできる。
275 この切り替えは
276 .BR seteuid (2),
277 .BR setreuid (2),
278 .BR setresuid (2)
279 を呼び出すことで実行できる。
280 set-group-ID プログラムは、
281 .BR setegid (2),
282 .BR setregid (2),
283 .BR setresgid (2)
284 を使って同様のことができる。
285 .\"O A process can obtain its saved set-user-ID (set-group-ID) using
286 .\"O .BR getresuid (2)
287 .\"O .RB ( getresgid (2)).
288 プロセスが自分の保存 set-user-ID、保存 set-group-ID を取得するには、
289 .BR getresuid(2),
290 .BR getresgids (2)
291 をそれぞれ使用する。
292 .IP *
293 .\"O File system user ID and file system group ID (Linux-specific).
294 ファイルシステム・ユーザ ID とファイルシステム・グループ ID (Linux 固有)。
295 .\"O These IDs, in conjunction with the supplementary group IDs described
296 .\"O below, are used to determine permissions for accessing files; see
297 .\"O .BR path_resolution (7)
298 .\"O for details.
299 .\"O Whenever a process's effective user (group) ID is changed,
300 .\"O the kernel also automatically changes the file system user (group) ID
301 .\"O to the same value.
302 .\"O Consequently, the file system IDs normally have the same values
303 .\"O as the corresponding effective ID, and the semantics for file-permission
304 .\"O checks are thus the same on Linux as on other UNIX systems.
305 .\"O The file system IDs can be made to differ from the effective IDs
306 .\"O by calling
307 .\"O .BR setfsuid (2)
308 .\"O and
309 .\"O .BR setfsgid (2).
310 これらの ID は、後述の補助グループ ID と組み合わせて使用され、
311 ファイルへのアクセス権の決定に利用される。詳細は
312 .BR path_resolution (7)
313 を参照。
314 プロセスの実効 ID (ユーザ ID や グループ ID) が変更されるたびに、
315 カーネルは自動的に対応するファイルシステム ID を同じ値に変更する。
316 その結果、ファイルシステム ID は通常は対応する実効 ID と同じ値となり、
317 ファイルのアクセス権のチェック方法は Linux と他の UNIX システムで同じである。
318 ファイルシステム ID は実効 ID とは異なる値にすることができ、
319 変更は
320 .BR setfsuid (2)
321
322 .BR setfsgid (2)
323 を呼び出して行う。
324 .IP *
325 .\"O Supplementary group IDs.
326 補助グループ ID。
327 .\"O This is a set of additional group IDs that are used for permission
328 .\"O checks when accessing files and other shared resources.
329 .\"O On Linux kernels before 2.6.4,
330 .\"O a process can be a member of up to 32 supplementary groups;
331 .\"O since kernel 2.6.4,
332 .\"O a process can be a member of up to 65536 supplementary groups.
333 この ID は、ファイルや他の共有リソースへのアクセス時にアクセス許可の
334 チェックに使用される、追加のグループ ID の集合である。
335 カーネル 2.6.4 より前の Linux では、一つのプロセスあたりの
336 補助グループのメンバー数は最大で 32 である。
337 カーネル 2.6.4 以降では、一つのプロセスあたりの
338 補助グループのメンバー数は最大で 65536 である。
339 .\"O The call
340 .\"O .I sysconf(_SC_NGROUPS_MAX)
341 .\"O can be used to determine the number of supplementary groups
342 .\"O of which a process may be a member.
343 .I sysconf(_SC_NGROUPS_MAX)
344 を呼び出すことで、あるプロセスがメンバーとなることができる可能性のある
345 補助グループ数を知ることができる。
346 .\" Since kernel 2.6.4, the limit is visible via the read-only file
347 .\" /proc/sys/kernel/ngroups_max.
348 .\" As at 2.6.22-rc2, this file is still read-only.
349 .\"O A process can obtain its set of supplementary group IDs using
350 .\"O .BR getgroups (2),
351 .\"O and can modify the set using
352 .\"O .BR setgroups (2).
353 プロセスは、自分の補助グループ ID の集合を
354 .BR getgroups (2)
355 で取得でき、
356 .BR setgroups (2)
357 で集合を変更できる。
358 .PP
359 .\"O A child process created by
360 .\"O .BR fork (2)
361 .\"O inherits copies of its parent's user and groups IDs.
362 .\"O During an
363 .\"O .BR execve (2),
364 .\"O a process's real user and group ID and supplementary
365 .\"O group IDs are preserved;
366 .\"O the effective and saved set IDs may be changed, as described in
367 .\"O .BR execve (2).
368 .BR fork (2)
369 で生成された子プロセスは親プロセスのユーザ ID とグループ ID を継承する。
370 .BR execve (2)
371 の間、プロセスの実ユーザ/グループ ID と補助グループ ID 集合は不変である。
372 実効 ID と保存セット ID は変更される可能性がある
373 .RB ( execve (2)
374 で説明されている)。
375
376 .\"O Aside from the purposes noted above,
377 .\"O a process's user IDs are also employed in a number of other contexts:
378 上記の目的以外にも、プロセスのユーザ ID は他の様々な場面で利用される。
379 .IP * 3
380 .\"O when determining the permissions for sending signals\(emsee
381 .\"O .BR kill (2);
382 シグナルを送る許可の判定時\(em
383 .BR kill (2)
384 参照。
385 .IP *
386 .\"O when determining the permissions for setting
387 .\"O process-scheduling parameters (nice value, real time
388 .\"O scheduling policy and priority, CPU affinity, I/O priority) using
389 .\"O .BR setpriority (2),
390 .\"O .BR sched_setaffinity (2),
391 .\"O .BR sched_setscheduler (2),
392 .\"O .BR sched_setparam (2),
393 .\"O and
394 .\"O .BR ioprio_set (2);
395 プロセスのスケジューリング関連のパラメータ (nice 値、
396 リアルタイム・スケジューリングポリシーや優先度、CPU affinity、
397 入出力優先度) の設定許可の判定時。
398 スケジューリング関連のパラメータ設定には
399 .BR setpriority (2),
400 .BR sched_setaffinity (2),
401 .BR sched_setscheduler (2),
402 .BR sched_setparam (2),
403 .BR ioprio_set (2)
404 が使用される。
405 .IP *
406 .\"O when checking resource limits; see
407 .\"O .BR getrlimit (2);
408 リソース上限のチェック時。
409 .BR getrlimit (2)
410 参照。
411 .IP *
412 .\"O when checking the limit on the number of inotify instances
413 .\"O that the process may create; see
414 .\"O .BR inotify (7).
415 プロセスが生成できる inotify インスタンス数の上限のチェック時。
416 .BR inotify (7)
417 参照。
418 .\"O .SH "CONFORMING TO"
419 .SH 準拠
420 .\"O Process IDs, parent process IDs, process group IDs, and session IDs
421 .\"O are specified in POSIX.1-2001.
422 .\"O The real, effective, and saved set user and groups IDs,
423 .\"O and the supplementary group IDs, are specified in POSIX.1-2001.
424 .\"O The file system user and group IDs are a Linux extension.
425 プロセス ID、親プロセス ID、プロセスグループ ID、セッション ID は
426 POSIX.1-2001 で規定されている。
427 実 ID、実効 ID、保存セット ID のユーザ ID / グループ ID および
428 補助グループ ID は POSIX.1-2001 で規定されている。
429 ファイルシステム・ユーザ ID / グループ ID は Linux による拡張である。
430 .\"O .SH NOTES
431 .SH 注意
432 .\"O The POSIX threads specification requires that
433 .\"O credentials are shared by all of the threads in a process.
434 .\"O However, at the kernel level, Linux maintains separate user and group
435 .\"O credentials for each thread.
436 .\"O The NPTL threading implementation does some work to ensure
437 .\"O that any change to user or group credentials
438 .\"O (e.g., calls to
439 .\"O .BR setuid (2),
440 .\"O .BR setresuid (2),
441 .\"O etc.)
442 .\"O is carried through to all of the POSIX threads in a process.
443 POSIX のスレッド仕様では、これらの識別子がプロセス内の全スレッドで
444 共有されることを求めている。
445 しかしながら、カーネルのレベルでは、Linux はスレッド毎に別々の
446 ユーザとグループに関する識別子を管理している。
447 NPTL スレッド実装が、(例えば
448 .BR setuid (2),
449 .BR setresuid (2)
450 などの呼び出しによる) ユーザやグループに関する識別子に対する変更が
451 プロセス内の全ての POSIX スレッドに対して反映されることを保証する
452 ための処理を行っている。
453 .\"O .SH "SEE ALSO"
454 .SH 関連項目
455 .BR bash (1),
456 .BR csh (1),
457 .BR ps (1),
458 .BR access (2),
459 .BR execve (2),
460 .BR faccessat (2),
461 .BR fork (2),
462 .BR getpgrp (2),
463 .BR getpid (2),
464 .BR getppid (2),
465 .BR getsid (2),
466 .BR kill (2),
467 .BR killpg (2),
468 .BR setegid (2),
469 .BR seteuid (2),
470 .BR setfsgid (2),
471 .BR setfsuid (2),
472 .BR setgid (2),
473 .BR setgroups (2),
474 .BR setresgid (2),
475 .BR setresuid (2),
476 .BR setuid (2),
477 .BR waitpid (2),
478 .BR euidaccess (3),
479 .BR initgroups (3),
480 .BR tcgetpgrp (3),
481 .BR tcsetpgrp (3),
482 .BR capabilities (7),
483 .BR path_resolution (7),
484 .BR unix (7)