.\" Copyright (C) 1995, Thomas K. Dyas .\" and Copyright (C) 2019, Michael Kerrisk .\" .\" %%%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 2019\-05\-09 Linux "Linux Programmer's Manual" .SH 名前 setfsgid \- ファイルシステムのチェックに用いられるグループ ID を設定する .SH 書式 \fB#include \fP .PP \fBint setfsgid(uid_t \fP\fIfsgid\fP\fB);\fP .SH 説明 On Linux, a process has both a filesystem group ID and an effective group ID. The (Linux\-specific) filesystem group ID is used for permissions checking when accessing filesystem objects, while the effective group ID is used for some other kinds of permissions checks (see \fBcredentials\fP(7)). .PP Normally, the value of the process's filesystem group ID is the same as the value of its effective group ID. This is so, because whenever a process's effective group ID is changed, the kernel also changes the filesystem group ID to be the same as the new value of the effective group ID. A process can cause the value of its filesystem group ID to diverge from its effective group ID by using \fBsetfsgid\fP() to change its filesystem group ID to the value given in \fIfsgid\fP. .PP \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 注意 The filesystem group ID concept and the \fBsetfsgid\fP() system call were invented for historical reasons that are no longer applicable on modern Linux kernels. See \fBsetfsuid\fP(2) for a discussion of why the use of both \fBsetfsuid\fP(2) and \fBsetfsgid\fP() is nowadays unneeded. .PP 元々の Linux の \fBsetfsgid\fP() システムコールは 16 ビットのグループ ID だけに対応していた。 その後、Linux 2.4 で、32 ビットの ID に対応した \fBsetfsgid32\fP() が追加された。 glibc の \fBsetfsgid\fP() のラッパー関数は カーネルバージョンによるこの違いを吸収している。 .SS "C ライブラリとカーネルの違い" In glibc 2.15 and earlier, when the wrapper for this system call determines that the argument can't be passed to the kernel without integer truncation (because the kernel is old and does not support 32\-bit group IDs), it will return \-1 and set \fIerrno\fP to \fBEINVAL\fP without attempting the system call. .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 プロジェクトのリリース 5.10 の一部である。プロジェクトの説明とバグ報告に関する情報は \%https://www.kernel.org/doc/man\-pages/ に書かれている。