setfsgidのヘルプ・マニュアル
日本語 英語
setfsgid --help
man setfsgid
SETFSGID(2) Linux Programmer’s Manual SETFSGID(2)
名前
setfsgid - ファイル・システムのチェックに用いられるグループ ID を設定す
る
書式
#include /* glibc では */
int setfsgid(uid_t fsgid);
説明
システムコール setfsgid() は Linux カーネルがファイル・システムに対する
全 て のアクセスのチェックに使用するグループ IDを設定する。通常は fsgid
の値は実効 (effective) グループID と同じになる。実際、実効グルー プ ID
が変更される度に fsgid もまた新しい実効グループID の値に変更される。
通 常 、 setfsuid() や setfsgid() が明示的に呼び出されるのは、Linux NFS
サーバー のように、ファイル・アクセスに用いるユーザID / グループID を変
更 しなければならないが、対応する実(real)/実効(effective) ユーザID / グ
ループID は変更したくないようなプログラムに限られる。 NFS サーバーの よ
うなプログラムで、通常のユーザID を変更すると、プロセスを望まないシグナ
ルにさらす可能性があり、セキュリティ・ホールになる。(下記参照)
setfsgid() は、スーパー・ユーザによって呼び出された場合か、 fsgid が 実
グループID、実効グループID、保存セットグループID (saved set-group-ID)、
現在の fsgid の値のいずれかに一致する場合にのみ成功する。
返り値
成功した場合、 fsgid の以前の値を返す。エラーの場合は fsgid の現在の 値
を返す。
バージョン
このシステムコールはバージョン 1.2 以降の Linux に存在する。
準拠
setfsgid() は Linux 特有であり、移植を想定したプログラムで使用してはい
けない。
注意
glibc が引き数がグループID として不正だと判断した場合は、システム・コー
ルを行わず errno に EINVAL を設定して -1 が返される。
こ のシステムコールが導入された当時、プロセスは同じ実効ユーザIDのプロセ
スへシグナルを送ることができた。今日では、シグナル送信権限の扱いはか な
り違うものになっている。
バグ
い かなる種類のエラー・メッセージも返さない。失敗した場合は (呼び出し元
には CAP_SETGID ケーパビリティがなかったのだから) 最低でも EPERM くらい
は返すべきである。
関連項目
kill(2), setfsuid(2), capabilities(7), credentials(7)
Linux 2008-12-05 SETFSGID(2)
SETFSGID(2) Linux Programmer’s Manual SETFSGID(2)
NAME
setfsgid - set group identity used for file system checks
SYNOPSIS
#include /* glibc uses */
int setfsgid(uid_t fsgid);
DESCRIPTION
The system call setfsgid() sets the group ID that the Linux kernel uses
to check for all accesses to the file system. Normally, the value of
fsgid will shadow the value of the effective group ID. In fact, when-
ever the effective group ID is changed, fsgid will also be changed to
the new value of the effective group ID.
Explicit calls to setfsuid(2) and setfsgid() are usually only used by
programs such as the Linux NFS server that need to change what user and
group ID is used for file access without a corresponding change in the
real and effective user and group IDs. A change in the normal user IDs
for a program such as the NFS server is a security hole that can expose
it to unwanted signals. (But see below.)
setfsgid() will only succeed if the caller is the superuser or if fsgid
matches either the real group ID, effective group ID, saved set-group-
ID, or the current value of fsgid.
RETURN VALUE
On success, the previous value of fsgid is returned. On error, the
current value of fsgid is returned.
VERSIONS
This system call is present in Linux since version 1.2.
CONFORMING TO
setfsgid() is Linux-specific and should not be used in programs
intended to be portable.
NOTES
When glibc determines that the argument is not a valid group ID, it
will return -1 and set errno to EINVAL without attempting the system
call.
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 sig-
nal permission handling is slightly different.
BUGS
No error messages of any kind are returned to the caller. At the very
least, EPERM should be returned when the call fails (because the caller
lacks the CAP_SETGID capability).
SEE ALSO
kill(2), setfsuid(2), capabilities(7), credentials(7)
COLOPHON
This page is part of release 3.22 of the Linux man-pages project. A
description of the project, and information about reporting bugs, can
be found at http://www.kernel.org/doc/man-pages/.
Linux 2008-12-05 SETFSGID(2)