.\" 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 説明 The system call \fBsetfsgid\fP() changes the value of the caller's filesystem group ID\(emthe group ID that the Linux kernel uses to check for all accesses to the filesystem. Normally, the value of the filesystem group ID will shadow the value of the effective group ID. In fact, whenever the effective group ID is changed, the filesystem group ID will also be changed to the new value of the effective group ID. 通常、 \fBsetfsuid\fP() や \fBsetfsgid\fP() を明示的に呼び出すのは、Linux NFS サーバー のように、 ファイルアクセスに用いるユーザID / グループID を変更しなければならないが、 対応する実(real)/実効(effective) ユーザID / グループID は変更したくないような プログラムに限られる。 NFS サーバーのようなプログラムで、通常のユーザID を変更すると、 プロセスを望まないシグナルにさらす可能性があり、 セキュリティホールになる。(下記参照) \fBsetfsgid\fP() will succeed only if the caller is the superuser or if \fIfsgid\fP matches either the caller's real group ID, effective group ID, saved set\-group\-ID, or current the filesystem user ID. .SH 返り値 On both success and failure, this call returns the previous filesystem group ID of the caller. .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 Note that at the time this system call was introduced, a process could send a signal to a process with the same effective user ID. Today signal permission handling is slightly different. See \fBsetfsuid\fP(2) for a discussion of why the use of both \fBsetfsuid\fP(2) and \fBsetfsgid\fP() is nowadays unneeded. 元々の Linux の \fBsetfsgid\fP() システムコールは 16 ビットのグループ ID だけに対応していた。 その後、Linux 2.4 で、32 ビットの ID に対応した \fBsetfsgid32\fP() が追加された。 glibc の \fBsetfsgid\fP() のラッパー関数は カーネルバージョンによるこの違いを吸収している。 .SH バグ No error indications of any kind are returned to the caller, and the fact that both successful and unsuccessful calls return the same value makes it impossible to directly determine whether the call succeeded or failed. Instead, the caller must resort to looking at the return value from a further call such as \fIsetfsgid(\-1)\fP (which will always fail), in order to determine if a preceding call to \fBsetfsgid\fP() changed the filesystem group ID. At the very least, \fBEPERM\fP should be returned when the call fails (because the caller lacks the \fBCAP_SETGID\fP capability). .SH 関連項目 \fBkill\fP(2), \fBsetfsuid\fP(2), \fBcapabilities\fP(7), \fBcredentials\fP(7) .SH この文書について この man ページは Linux \fIman\-pages\fP プロジェクトのリリース 3.54 の一部 である。プロジェクトの説明とバグ報告に関する情報は http://www.kernel.org/doc/man\-pages/ に書かれている。