plucky (2) setfsgid.2.gz

Provided by: manpages-ja-dev_0.5.0.0.20221215+dfsg-1_all bug

名前

       setfsgid - ファイルシステムのチェックに用いられるグループ ID を設定する

書式

       #include <sys/fsuid.h>

       int setfsgid(uid_t fsgid);

説明

       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 credentials(7)).

       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  setfsgid()   to  change
       its filesystem group ID to the value given in fsgid.

       setfsgid()  は、スーパーユーザーによって呼び出された場合か、 fsgid が呼び出し元の実グループID、実効グルー
       プID、 保存セットグループID (saved set-group-ID)、現在のファイルシステムグループ ID  の値のいずれかに一致
       する場合にのみ成功する。

返り値

       成功時も失敗時も、 この呼び出しは直前の呼び出し元のファイルシステムグループ ID の値を返す。

バージョン

       このシステムコールはバージョン 1.2 以降の Linux に存在する。

準拠

       setfsgid()  は Linux 特有であり、移植を想定したプログラムで使用してはいけない。

注意

       The filesystem group ID concept and the setfsgid()  system call were invented for historical reasons that
       are no longer applicable on modern Linux kernels.  See setfsuid(2)  for a discussion of why  the  use  of
       both setfsuid(2)  and setfsgid()  is nowadays unneeded.

       元々の Linux の setfsgid() システムコールは 16 ビットのグループ ID だけに対応していた。 その後、Linux 2.4
       で、32 ビットの ID に対応した setfsgid32() が追加された。 glibc の setfsgid()  のラッパー関数は  カーネル
       バージョンによるこの違いを吸収している。

   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 errno to EINVAL without attempting the system call.

バグ

       いかなる種類のエラーメッセージも返さず、  成功した場合も失敗した場合も呼び出しは同じ値を返すため、 呼び出
       しが成功したか失敗したかを直接判定することはできない。 その代わり、 直前の setfsgid()  の呼び出しがファイ
       ルシステムグループ ID を変更したかどうかを判定するために、 呼び出し元はこの後に setfsgid(-1) などを呼び出
       して返り値を見なければならない (setfsgid(-1) は常に失敗する)。 最低でも、失敗した場合は EPERM  くらいは返
       すべきである (呼び出し元には CAP_SETGID ケーパビリティがなかったのだから)。

関連項目

       kill(2), setfsuid(2), capabilities(7), credentials(7)

この文書について

       この  man ページは Linux man-pages プロジェクトのリリース 5.10 の一部である。プロジェクトの説明とバグ報告
       に関する情報は https://www.kernel.org/doc/man-pages/ に書かれている。