Man page - setfsgid(2)

Packages contains this manual

Available languages:

en fr ja ru ro de

Manual

SETFSGID

名 前
書 式
説 明
返 り 値
バ ー ジ ョ ン
準 拠
注 意
C ラ イ ブ ラ リ と カ ー ネ ル の 違 い
バ グ
関 連 項 目
こ の 文 書 に つ い て

名 前

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/ に 書 か れ て い る 。