OSDN Git Service

Update README
[linuxjm/LDP_man-pages.git] / draft / man2 / setfsgid.2
1 .\" Copyright (C) 1995, Thomas K. Dyas <tdyas@eden.rutgers.edu>
2 .\"
3 .\" %%%LICENSE_START(VERBATIM)
4 .\" Permission is granted to make and distribute verbatim copies of this
5 .\" manual provided the copyright notice and this permission notice are
6 .\" preserved on all copies.
7 .\"
8 .\" Permission is granted to copy and distribute modified versions of this
9 .\" manual under the conditions for verbatim copying, provided that the
10 .\" entire resulting derived work is distributed under the terms of a
11 .\" permission notice identical to this one.
12 .\"
13 .\" Since the Linux kernel and libraries are constantly changing, this
14 .\" manual page may be incorrect or out-of-date.  The author(s) assume no
15 .\" responsibility for errors or omissions, or for damages resulting from
16 .\" the use of the information contained herein.  The author(s) may not
17 .\" have taken the same level of care in the production of this manual,
18 .\" which is licensed free of charge, as they might when working
19 .\" professionally.
20 .\"
21 .\" Formatted or processed versions of this manual, if unaccompanied by
22 .\" the source, must acknowledge the copyright and authors of this work.
23 .\" %%%LICENSE_END
24 .\"
25 .\" Created   1995-08-06 Thomas K. Dyas <tdyas@eden.rutgers.edu>
26 .\" Modified  2000-07-01 aeb
27 .\" Modified  2002-07-23 aeb
28 .\" Modified, 27 May 2004, Michael Kerrisk <mtk.manpages@gmail.com>
29 .\"     Added notes on capability requirements
30 .\"
31 .\"*******************************************************************
32 .\"
33 .\" This file was generated with po4a. Translate the source file.
34 .\"
35 .\"*******************************************************************
36 .\"
37 .\" Japanese Version Copyright (c) 1997 HANATAKA Shinya
38 .\"         all rights reserved.
39 .\" Translated Sat Mar  1 00:54:23 JST 1997
40 .\"         by HANATAKA Shinya <hanataka@abyss.rim.or.jp>
41 .\" Modified Mon Sep 23 21:21:54 JST 2000
42 .\"         by HANATAKA Shinya <hanataka@abyss.rim.or.jp>
43 .\" Modified 2002-09-24 by Akihiro MOTOKI <amotoki@dd.iij4u.or.jp>
44 .\" Modified 2005-02-24, Akihiro MOTOKI <amotoki@dd.iij4u.or.jp>
45 .\" Updated 2012-04-30, Akihiro MOTOKI <amotoki@gmail.com>
46 .\"
47 .TH SETFSGID 2 2013\-08\-08 Linux "Linux Programmer's Manual"
48 .SH 名前
49 setfsgid \- ファイルシステムのチェックに用いられるグループ ID を設定する
50 .SH 書式
51 \fB#include <sys/fsuid.h>\fP
52 .sp
53 \fBint setfsgid(uid_t \fP\fIfsgid\fP\fB);\fP
54 .SH 説明
55 システムコール \fBsetfsgid\fP() は、 呼び出し元のファイルシステムグループ ID \(em
56 ファイルシステムへの全てのアクセスのチェックにおいて Linux カーネルが使用するグループ ID \(em
57 の値を変更する。通常はファイルシステムグループ ID の値は実効 (effective) グループ ID と同じになる。実際、 実効グループ ID
58 が変更される度にファイルシステムグループ ID もまた新しい実効グループ ID の値に変更される。
59
60 通常、 \fBsetfsuid\fP()  や \fBsetfsgid\fP() を明示的に呼び出すのは、Linux NFS サーバー のように、
61 ファイルアクセスに用いるユーザーID / グループID を変更しなければならないが、 対応する実(real)/実効(effective) ユーザーID
62 / グループID は変更したくないような プログラムに限られる。 NFS サーバーのようなプログラムで、通常のユーザーID を変更すると、
63 プロセスを望まないシグナルにさらす可能性があり、 セキュリティホールになる。(下記参照)
64
65 \fBsetfsgid\fP()  は、スーパーユーザーによって呼び出された場合か、 \fIfsgid\fP が呼び出し元の実グループID、実効グループID、
66 保存セットグループID (saved set\-group\-ID)、現在のファイルシステムグループ ID の値のいずれかに一致する場合にのみ成功する。
67 .SH 返り値
68 成功時も失敗時も、 この呼び出しは直前の呼び出し元のファイルシステムグループ ID の値を返す。
69 .SH バージョン
70 .\" This system call is present since Linux 1.1.44
71 .\" and in libc since libc 4.7.6.
72 このシステムコールはバージョン 1.2 以降の Linux に存在する。
73 .SH 準拠
74 \fBsetfsgid\fP()  は Linux 特有であり、移植を想定したプログラムで使用してはいけない。
75 .SH 注意
76 glibc が引き数がグループID として不正だと判断した場合は、 システムコールを行わず \fIerrno\fP に \fBEINVAL\fP を設定して \-1
77 が返される。
78 .LP
79 このシステムコールが導入された当時、プロセスは 同じ実効ユーザーIDのプロセスへシグナルを送ることができた。
80 今日では、シグナル送信権限の扱いはかなり違うものになっている。 なぜ今日では \fBsetfsuid\fP(2) と \fBsetfsgid\fP()
81 の両者が不要なのかの議論については \fBsetfsuid\fP(2) を参照のこと。
82
83 元々の Linux の \fBsetfsgid\fP() システムコールは
84 16 ビットのグループ ID だけに対応していた。
85 その後、Linux 2.4 で、32 ビットの ID に対応した
86 \fBsetfsgid32\fP() が追加された。
87 glibc の \fBsetfsgid\fP() のラッパー関数は
88 カーネルバージョンによるこの違いを吸収している。
89 .SH バグ
90 いかなる種類のエラーメッセージも返さず、 成功した場合も失敗した場合も呼び出しは同じ値を返すため、
91 呼び出しが成功したか失敗したかを直接判定することはできない。 その代わり、 直前の \fBsetfsgid\fP() の呼び出しがファイルシステムグループ
92 ID を変更したかどうかを判定するために、 呼び出し元はこの後に \fIsetfsgid(\-1)\fP などを呼び出して返り値を見なければならない
93 (\fIsetfsgid(\-1)\fP は常に失敗する)。 最低でも、失敗した場合は \fBEPERM\fP くらいは返すべきである (呼び出し元には
94 \fBCAP_SETGID\fP ケーパビリティがなかったのだから)。
95 .SH 関連項目
96 \fBkill\fP(2), \fBsetfsuid\fP(2), \fBcapabilities\fP(7), \fBcredentials\fP(7)
97 .SH この文書について
98 この man ページは Linux \fIman\-pages\fP プロジェクトのリリース 3.79 の一部
99 である。プロジェクトの説明とバグ報告に関する情報は
100 http://www.kernel.org/doc/man\-pages/ に書かれている。