OSDN Git Service

(split) Convert release and draft pages to UTF-8.
[linuxjm/LDP_man-pages.git] / release / man2 / setresuid.2
1 .\" Hey Emacs! This file is -*- nroff -*- source.
2 .\"
3 .\" Copyright (C) 1997 Andries Brouwer (aeb@cwi.nl)
4 .\"
5 .\" Permission is granted to make and distribute verbatim copies of this
6 .\" manual provided the copyright notice and this permission notice are
7 .\" preserved on all copies.
8 .\"
9 .\" Permission is granted to copy and distribute modified versions of this
10 .\" manual under the conditions for verbatim copying, provided that the
11 .\" entire resulting derived work is distributed under the terms of a
12 .\" permission notice identical to this one.
13 .\"
14 .\" Since the Linux kernel and libraries are constantly changing, this
15 .\" manual page may be incorrect or out-of-date.  The author(s) assume no
16 .\" responsibility for errors or omissions, or for damages resulting from
17 .\" the use of the information contained herein.  The author(s) may not
18 .\" have taken the same level of care in the production of this manual,
19 .\" which is licensed free of charge, as they might when working
20 .\" professionally.
21 .\"
22 .\" Formatted or processed versions of this manual, if unaccompanied by
23 .\" the source, must acknowledge the copyright and authors of this work.
24 .\"
25 .\" Modified, 2003-05-26, Michael Kerrisk, <mtk.manpages@gmail.com>
26 .\"
27 .\" Japanese Version Copyright (c) 1997 HANATAKA Shinya
28 .\"         all rights reserved.
29 .\" Translated 1997-08-30, HANATAKA Shinya <hanataka@abyss.rim.or.jp>
30 .\" Updated & Modified 2004-05-22, Yuichi SATO <ysato444@yahoo.co.jp>
31 .\" Updated & Modified 2005-01-04, Yuichi SATO
32 .\" Updated & Modified 2005-09-03, Akihiro MOTOKI <amotoki@dd.iij4u.or.jp>
33 .\" Updated & Modified 2005-11-04, Akihiro MOTOKI <amotoki@dd.iij4u.or.jp>
34 .\"
35 .\"WORD:        effective user ID       実効ユーザーID
36 .\"WORD:        real user ID            実ユーザーID
37 .\"WORD:        saved set-user-ID       保存セットユーザーID
38 .\"WORD:        effective group ID      実効グループID
39 .\"WORD:        real group ID           実グループID
40 .\"WORD:        saved group ID          保存グループID
41 .\"
42 .TH SETRESUID 2 2007-07-26 "Linux" "Linux Programmer's Manual"
43 .SH 名前
44 setresuid, setresgid \- ユーザやグループの 実、実効、保存 ID を設定する
45 .SH 書式
46 .BR "#define _GNU_SOURCE" "         /* feature_test_macros(7) 参照 */"
47 .br
48 .B #include <unistd.h>
49 .sp
50 .BI "int setresuid(uid_t " ruid ", uid_t " euid ", uid_t " suid );
51 .br
52 .BI "int setresgid(gid_t " rgid ", gid_t " egid ", gid_t " sgid );
53 .SH 説明
54 .BR setresuid ()
55 は呼び出し元のプロセスの実 (real) ユーザーID、実効 (effective) ユーザーID、
56 保存 set-user-ID を設定する。
57
58 非特権ユーザーのプロセスは、その実 UID、実効 UID、保存 set-user-ID を、
59 現在の実 UID、現在の実効 UID、現在の保存 set-user-ID
60 のどれかに変更することができる:
61
62 特権プロセス (Linux では \fBCAP_SETUID\fP ケーパビリティ (capability) を持つ
63 プロセス) は、実 UID、実効 UID、保存 set-user-ID を任意の値に設定できる。
64
65 引き数のどれかが \-1 の場合はその値は変更されずに残される。
66
67 実 UID、実効 UID、保存 set-user-ID にどんな変更が行われたかに関わらず、
68 ファイルシステム UID は常に実効 UID (可能であれば変更後の新しい実効 UID)
69 と同じ値に設定される。
70
71 全く同じように、
72 .BR setresgid ()
73 は呼び出し元のプロセスの実 GID、実効 GID、保存 set-group-ID を設定する
74 (さらにファイルシステム GID を実効 GID と同じ値に修正する)。
75 非特権プロセスは同様の制限を受ける。
76 .SH 返り値
77 成功した場合は 0 が返される。エラーの場合は \-1 が返され、
78 .I errno
79 が適切に設定される。
80 .SH エラー
81 .TP
82 .B EAGAIN
83 .I uid
84 が現在のユーザー ID と違う値で、
85 この呼び出しにより ユーザー ID が
86 リソース上限
87 .B RLIMIT_NPROC
88 を超えてしまう。
89 .TP
90 .B EPERM
91 呼び出したプロセスが特権を持たないのに
92 (\fBCAP_SETUID\fP ケーパビリティを持たないのに)、
93 ID を許されていない値に変更しようとした。
94 .SH バージョン
95 Linux ではバージョン 2.1.44 より利用可能になった。
96 .SH 準拠
97 これらのコールは非標準である。
98 HP-UX や BSD 系のいくつかにも存在する。
99 .SH 注意
100 HP-UX や FreeBSD では
101 .I <unistd.h>
102 にプロトタイプが存在する。
103 Linux では、glibc 2.3.2 以降で
104 プロトタイプが提供されている。
105 .SH 関連項目
106 .BR getresuid (2),
107 .BR getuid (2),
108 .BR setfsgid (2),
109 .BR setfsuid (2),
110 .BR setreuid (2),
111 .BR setuid (2),
112 .BR capabilities (7),
113 .BR credentials (7)