OSDN Git Service

(split) LDP: Release pages for LDP v3.39.
[linuxjm/LDP_man-pages.git] / release / man2 / setfsgid.2
1 .\" Copyright (C) 1995, Thomas K. Dyas <tdyas@eden.rutgers.edu>
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 .\" Created   1995-08-06 Thomas K. Dyas <tdyas@eden.rutgers.edu>
24 .\" Modified  2000-07-01 aeb
25 .\" Modified  2002-07-23 aeb
26 .\" Modified, 27 May 2004, Michael Kerrisk <mtk.manpages@gmail.com>
27 .\"     Added notes on capability requirements
28 .\"
29 .\"*******************************************************************
30 .\"
31 .\" This file was generated with po4a. Translate the source file.
32 .\"
33 .\"*******************************************************************
34 .TH SETFSGID 2 2010\-11\-22 Linux "Linux Programmer's Manual"
35 .SH 名前
36 setfsgid \- ファイルシステムのチェックに用いられるグループ ID を設定する
37 .SH 書式
38 \fB#include <unistd.h>\fP /* glibc では <sys/fsuid.h> */
39 .sp
40 \fBint setfsgid(uid_t \fP\fIfsgid\fP\fB);\fP
41 .SH 説明
42 システムコール \fBsetfsgid\fP()  は Linux カーネルがファイルシステムに対する 全てのアクセスのチェックに使用するグループ
43 IDを設定する。通常は \fIfsgid\fP の値は実効 (effective) グループID と同じになる。実際、 実効グループ ID が変更される度に
44 \fIfsgid\fP もまた新しい実効グループID の値に変更される。
45
46 通常、 \fBsetfsuid\fP()  や \fBsetfsgid\fP()  が明示的に呼び出されるのは、Linux NFS サーバー のように、
47 ファイルアクセスに用いるユーザID / グループID を変更しなければならないが、 対応する実(real)/実効(effective) ユーザID /
48 グループID は変更したくないような プログラムに限られる。 NFS サーバーのようなプログラムで、通常のユーザID を変更すると、
49 プロセスを望まないシグナルにさらす可能性があり、 セキュリティホールになる。(下記参照)
50
51 \fBsetfsgid\fP()  は、スーパーユーザによって呼び出された場合か、 \fIfsgid\fP が実グループID、実効グループID、
52 保存セットグループID (saved set\-group\-ID)、現在の \fIfsgid\fP の値のいずれかに一致する場合にのみ成功する。
53 .SH 返り値
54 成功した場合、 \fIfsgid\fP の以前の値を返す。エラーの場合は \fIfsgid\fP の現在の値を返す。
55 .SH バージョン
56 .\" This system call is present since Linux 1.1.44
57 .\" and in libc since libc 4.7.6.
58 このシステムコールはバージョン 1.2 以降の Linux に存在する。
59 .SH 準拠
60 \fBsetfsgid\fP()  は Linux 特有であり、移植を想定したプログラムで使用してはいけない。
61 .SH 注意
62 glibc が引き数がグループID として不正だと判断した場合は、 システムコールを行わず \fIerrno\fP に \fBEINVAL\fP を設定して \-1
63 が返される。
64 .LP
65 このシステムコールが導入された当時、プロセスは 同じ実効ユーザIDのプロセスへシグナルを送ることができた。
66 今日では、シグナル送信権限の扱いはかなり違うものになっている。
67
68 元々の Linux の \fBsetfsgid\fP() システムコールは
69 16 ビットのグループ ID だけに対応していた。
70 その後、Linux 2.4 で、32 ビットの ID に対応した
71 \fBsetfsgid32\fP() が追加された。
72 glibc の \fBsetfsgid\fP() のラッパー関数は
73 カーネルバージョンによるこの違いを吸収している。
74 .SH バグ
75 いかなる種類のエラーメッセージも返さない。 失敗した場合は (呼び出し元には \fBCAP_SETGID\fP ケーパビリティがなかったのだから) 最低でも
76 \fBEPERM\fP くらいは返すべきである。
77 .SH 関連項目
78 \fBkill\fP(2), \fBsetfsuid\fP(2), \fBcapabilities\fP(7), \fBcredentials\fP(7)