.\" Copyright (C) 1995, Thomas K. Dyas .\" .\" %%%LICENSE_START(VERBATIM) .\" Permission is granted to make and distribute verbatim copies of this .\" manual provided the copyright notice and this permission notice are .\" preserved on all copies. .\" .\" Permission is granted to copy and distribute modified versions of this .\" manual under the conditions for verbatim copying, provided that the .\" entire resulting derived work is distributed under the terms of a .\" permission notice identical to this one. .\" .\" Since the Linux kernel and libraries are constantly changing, this .\" manual page may be incorrect or out-of-date. The author(s) assume no .\" responsibility for errors or omissions, or for damages resulting from .\" the use of the information contained herein. The author(s) may not .\" have taken the same level of care in the production of this manual, .\" which is licensed free of charge, as they might when working .\" professionally. .\" .\" Formatted or processed versions of this manual, if unaccompanied by .\" the source, must acknowledge the copyright and authors of this work. .\" %%%LICENSE_END .\" .\" Created 1995-08-06 Thomas K. Dyas .\" Modified 2000-07-01 aeb .\" Modified 2002-07-23 aeb .\" Modified, 27 May 2004, Michael Kerrisk .\" Added notes on capability requirements .\" .\"******************************************************************* .\" .\" This file was generated with po4a. Translate the source file. .\" .\"******************************************************************* .\" .\" Japanese Version Copyright (c) 1997 HANATAKA Shinya .\" all rights reserved. .\" Translated Sat Mar 1 00:54:23 JST 1997 .\" by HANATAKA Shinya .\" Modified Mon Sep 23 21:21:54 JST 2000 .\" by HANATAKA Shinya .\" Modified 2002-09-24 by Akihiro MOTOKI .\" Modified 2005-02-24, Akihiro MOTOKI .\" Updated 2012-04-30, Akihiro MOTOKI .\" .TH SETFSGID 2 2013\-08\-08 Linux "Linux Programmer's Manual" .SH 名前 setfsgid \- ファイルシステムのチェックに用いられるグループ ID を設定する .SH 書式 \fB#include \fP .sp \fBint setfsgid(uid_t \fP\fIfsgid\fP\fB);\fP .SH 説明 システムコール \fBsetfsgid\fP() は、 呼び出し元のファイルシステムグループ ID \(em ファイルシステムへの全てのアクセスのチェックにおいて Linux カーネルが使用するグループ ID \(em の値を変更する。通常はファイルシステムグループ ID の値は実効 (effective) グループ ID と同じになる。実際、 実効グループ ID が変更される度にファイルシステムグループ ID もまた新しい実効グループ ID の値に変更される。 通常、 \fBsetfsuid\fP() や \fBsetfsgid\fP() を明示的に呼び出すのは、Linux NFS サーバー のように、 ファイルアクセスに用いるユーザID / グループID を変更しなければならないが、 対応する実(real)/実効(effective) ユーザID / グループID は変更したくないような プログラムに限られる。 NFS サーバーのようなプログラムで、通常のユーザID を変更すると、 プロセスを望まないシグナルにさらす可能性があり、 セキュリティホールになる。(下記参照) \fBsetfsgid\fP() は、スーパーユーザによって呼び出された場合か、 \fIfsgid\fP が呼び出し元の実グループID、実効グループID、 保存セットグループID (saved set\-group\-ID)、現在のファイルシステムグループ ID の値のいずれかに一致する場合にのみ成功する。 .SH 返り値 成功時も失敗時も、 この呼び出しは直前の呼び出し元のファイルシステムグループ ID の値を返す。 .SH バージョン .\" This system call is present since Linux 1.1.44 .\" and in libc since libc 4.7.6. このシステムコールはバージョン 1.2 以降の Linux に存在する。 .SH 準拠 \fBsetfsgid\fP() は Linux 特有であり、移植を想定したプログラムで使用してはいけない。 .SH 注意 glibc が引き数がグループID として不正だと判断した場合は、 システムコールを行わず \fIerrno\fP に \fBEINVAL\fP を設定して \-1 が返される。 .LP このシステムコールが導入された当時、プロセスは 同じ実効ユーザIDのプロセスへシグナルを送ることができた。 今日では、シグナル送信権限の扱いはかなり違うものになっている。 なぜ今日では \fBsetfsuid\fP(2) と \fBsetfsgid\fP() の両者が不要なのかの議論については \fBsetfsuid\fP(2) を参照のこと。 元々の Linux の \fBsetfsgid\fP() システムコールは 16 ビットのグループ ID だけに対応していた。 その後、Linux 2.4 で、32 ビットの ID に対応した \fBsetfsgid32\fP() が追加された。 glibc の \fBsetfsgid\fP() のラッパー関数は カーネルバージョンによるこの違いを吸収している。 .SH バグ いかなる種類のエラーメッセージも返さず、 成功した場合も失敗した場合も呼び出しは同じ値を返すため、 呼び出しが成功したか失敗したかを直接判定することはできない。 その代わり、 直前の \fBsetfsgid\fP() の呼び出しがファイルシステムグループ ID を変更したかどうかを判定するために、 呼び出し元はこの後に \fIsetfsgid(\-1)\fP などを呼び出して返り値を見なければならない (\fIsetfsgid(\-1)\fP は常に失敗する)。 最低でも、失敗した場合は \fBEPERM\fP くらいは返すべきである (呼び出し元には \fBCAP_SETGID\fP ケーパビリティがなかったのだから)。 .SH 関連項目 \fBkill\fP(2), \fBsetfsuid\fP(2), \fBcapabilities\fP(7), \fBcredentials\fP(7) .SH この文書について この man ページは Linux \fIman\-pages\fP プロジェクトのリリース 3.65 の一部 である。プロジェクトの説明とバグ報告に関する情報は http://www.kernel.org/doc/man\-pages/ に書かれている。