.\" Copyright (C) 1995, Thomas K. Dyas .\" .\" 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. .\" .\" 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 .\" .\" 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 .\" .\"WORD: identity ID .\"WORD: kernel カーネル .\"WORD: file system ファイル・システム .\"WORD: effective group ID 実効グループID .\"WORD: real group ID 実グループID .\"WORD: signal シグナル .\"WORD: security hole セキュリティ・ホール .\"WORD: saved set-group-ID 保存セットグループID .\" .TH SETFSGID 2 2008-12-05 "Linux" "Linux Programmer's Manual" .SH 名前 setfsgid \- ファイル・システムのチェックに用いられるグループ ID を設定する .SH 書式 .B #include /* glibc では */ .sp .BI "int setfsgid(uid_t " fsgid ); .SH 説明 システムコール .BR setfsgid () は Linux カーネルがファイル・システムに対する 全てのアクセスのチェックに使用するグループ IDを設定する。通常は .I fsgid の値は実効 (effective) グループID と同じになる。実際、 実効グループ ID が変更される度に .I fsgid もまた新しい実効グループID の値に変更される。 通常、 .BR setfsuid () や .BR setfsgid () が明示的に呼び出されるのは、Linux NFS サーバー のように、 ファイル・アクセスに用いるユーザID / グループID を変更しなければならないが、 対応する実(real)/実効(effective) ユーザID / グループID は変更したくないような プログラムに限られる。 NFS サーバーのようなプログラムで、通常のユーザID を変更すると、 プロセスを望まないシグナルにさらす可能性があり、 セキュリティ・ホールになる。(下記参照) .BR setfsgid () は、スーパー・ユーザによって呼び出された場合か、 .I fsgid が実グループID、実効グループID、 保存セットグループID (saved set-group-ID)、現在の .I fsgid の値のいずれかに一致する場合にのみ成功する。 .SH 返り値 成功した場合、 .I fsgid の以前の値を返す。エラーの場合は .I fsgid の現在の値を返す。 .SH バージョン このシステムコールはバージョン 1.2 以降の Linux に存在する。 .\" This system call is present since Linux 1.1.44 .\" and in libc since libc 4.7.6. .SH 準拠 .BR setfsgid () は Linux 特有であり、移植を想定したプログラムで使用してはいけない。 .SH 注意 glibc が引き数がグループID として不正だと判断した場合は、 システム・コールを行わず \fIerrno\fP に .B EINVAL を設定して \-1 が返される。 .LP このシステムコールが導入された当時、プロセスは 同じ実効ユーザIDのプロセスへシグナルを送ることができた。 今日では、シグナル送信権限の扱いはかなり違うものになっている。 .SH バグ いかなる種類のエラー・メッセージも返さない。 失敗した場合は (呼び出し元には .B CAP_SETGID ケーパビリティがなかったのだから) 最低でも .B EPERM くらいは返すべきである。 .SH 関連項目 .BR kill (2), .BR setfsuid (2), .BR capabilities (7), .BR credentials (7)