OSDN Git Service

(split) Convert release and draft pages to UTF-8.
[linuxjm/LDP_man-pages.git] / release / man2 / setfsuid.2
1 .\" Copyright (C) 1995, Thomas K. Dyas <tdyas@eden.rutgers.edu>
2 .\"
3 .\" Permission is granted to make and distribute verbatim copies of this
4 .\" manual provided the copyright notice and this permission notice are
5 .\" preserved on all copies.
6 .\"
7 .\" Permission is granted to copy and distribute modified versions of this
8 .\" manual under the conditions for verbatim copying, provided that the
9 .\" entire resulting derived work is distributed under the terms of a
10 .\" permission notice identical to this one.
11 .\"
12 .\" Since the Linux kernel and libraries are constantly changing, this
13 .\" manual page may be incorrect or out-of-date.  The author(s) assume no
14 .\" responsibility for errors or omissions, or for damages resulting from
15 .\" the use of the information contained herein.  The author(s) may not
16 .\" have taken the same level of care in the production of this manual,
17 .\" which is licensed free of charge, as they might when working
18 .\" professionally.
19 .\"
20 .\" Formatted or processed versions of this manual, if unaccompanied by
21 .\" the source, must acknowledge the copyright and authors of this work.
22 .\"
23 .\" Created   1995-08-06 Thomas K. Dyas <tdyas@eden.rutgers.edu>
24 .\" Modified  2000-07-01 aeb
25 .\" Modified  2002-07-23 aeb
26 .\" Modified, 27 May 2004, Michael Kerrisk <mtk.manpages@gmail.com>
27 .\"     Added notes on capability requirements
28 .\"
29 .\" Japanese Version Copyright (c) 1997 HANATAKA Shinya
30 .\"         all rights reserved.
31 .\" Translated Sat Mar  1 00:55:10 JST 1997
32 .\"         by HANATAKA Shinya <hanataka@abyss.rim.or.jp>
33 .\" Modified Mon Sep 23 21:15:17 JST 2000
34 .\"         by HANATAKA Shinya <hanataka@abyss.rim.or.jp>
35 .\" Modified 2002-09-24 by Akihiro MOTOKI <amotoki@dd.iij4u.or.jp>
36 .\" Modified 2005-02-24, Akihiro MOTOKI <amotoki@dd.iij4u.or.jp>
37 .\"
38 .\"WORD:        identity                ID
39 .\"WORD:        kernel                  カーネル
40 .\"WORD:        file system             ファイル・システム
41 .\"WORD:        effective user ID       実効ユーザID
42 .\"WORD:        real user ID            実ユーザID
43 .\"WORD:        signal                  シグナル
44 .\"WORD:        security hole           セキュリティ・ホール
45 .\"WORD:        saved set-user-ID       保存セットユーザID
46 .\"
47 .TH SETFSUID 2 2008-12-05 "Linux" "Linux Programmer's Manual"
48 .SH 名前
49 setfsuid \- ファイル・システムのチェックに用いられるユーザ ID を設定する
50 .SH 書式
51 .B #include <unistd.h>
52 /* glibc では <sys/fsuid.h> */
53 .sp
54 .BI "int setfsuid(uid_t " fsuid );
55 .SH 説明
56 .BR setfsuid ()
57 は Linux カーネルがファイル・システムに対する
58 全てのアクセスのチェックに使用するユーザID を設定する。通常は
59 .I fsuid
60 の値は実効 (effective) ユーザID と同じになる。実際、
61 実効ユーザID が変更される度に
62 .I fsuid
63 もまた新しい実効ユーザID の値に変更される。
64
65 通常、
66 .BR setfsuid ()
67
68 .BR setfsgid ()
69 が明示的に呼び出されるのは、Linux NFS サーバー のように、
70 ファイル・アクセスに用いるユーザID / グループID を変更しなければならないが、
71 対応する実(real)/実効(effective) ユーザID / グループID は変更したくないような
72 プログラムに限られる。
73 NFS サーバーのようなプログラムで、通常のユーザID を変更すると、
74 プロセスを望まないシグナルにさらす可能性があり、
75 セキュリティ・ホールになる。(下記参照)
76
77 .BR setfsuid ()
78 は、スーパー・ユーザによって呼び出された場合か、
79 .I fsuid
80 が実ユーザID、実効ユーザID、
81 保存セットユーザID (saved set-user-ID)、現在の
82 .I fsuid
83 の値のいずれかに一致する場合にのみ成功する。
84 .SH 返り値
85 成功した場合、
86 .I fsuid
87 の以前の値を返す。エラーの場合は
88 .I fsuid
89 の現在の値を返す。
90 .SH バージョン
91 このシステムコールはバージョン 1.2 以降の Linux に存在する。
92 .\" This system call is present since Linux 1.1.44
93 .\" and in libc since libc 4.7.6.
94 .SH 準拠
95 .BR setfsuid ()
96 は Linux 特有であり、移植を想定したプログラムで使用してはいけない。
97 .SH 注意
98 glibc が引き数がユーザID として不正だと判断した場合は、
99 システム・コールを行わず \fIerrno\fP に
100 .B EINVAL
101 を設定して \-1 が返される。
102 .LP
103 このシステムコールが導入された当時、プロセスは
104 同じ実効ユーザIDのプロセスへシグナルを送ることができた。
105 今日では、シグナル送信権限の扱いはかなり違うものになっている。
106 .SH バグ
107 いかなる種類のエラー・メッセージも呼び出し元に返さない。
108 失敗した場合は (呼び出し元には
109 .B CAP_SETUID
110 ケーパビリティがなかったのだから) 最低でも
111 .B EPERM
112 くらいは返すべきである。
113 .SH 関連項目
114 .BR kill (2),
115 .BR setfsgid (2),
116 .BR capabilities (7),
117 .BR credentials (7)