OSDN Git Service

Convert release and draft pages to UTF-8.
[linuxjm/jm.git] / manual / LDP_man-pages / draft / man2 / chmod.2
1 .\" Hey Emacs! This file is -*- nroff -*- source.
2 .\"
3 .\" Copyright (c) 1992 Drew Eckhardt (drew@cs.colorado.edu), March 28, 1992
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 by Michael Haardt <michael@moria.de>
26 .\" Modified 1993-07-21 by Rik Faith <faith@cs.unc.edu>
27 .\" Modified 1997-01-12 by Michael Haardt
28 .\"   <michael@cantor.informatik.rwth-aachen.de>: NFS details
29 .\" Modified 2004-06-23 by Michael Kerrisk <mtk.manpages@gmail.com>
30 .\"
31 .\" Japanese Version Copyright (c) 1996 Yosiaki Yanagihara
32 .\"         all rights reserved.
33 .\" Translated 1996-06-24, Yosiaki Yanagihara <yosiaki@bsd2.kbnes.nec.co.jp>
34 .\" Modified 1998-05-11, HANATAKA Shinya <hanataka@abyss.rim.or.jp>
35 .\" Updated & Modified 2001-06-25, Yuichi SATO <ysato@h4.dion.ne.jp>
36 .\" Updated & Modified 2004-12-29, Yuichi SATO <ysato444@yahoo.co.jp>
37 .\" Updated 2008-08-09, Akihiro MOTOKI <amotoki@dd.iij4u.or.jp>, LDP v3.05
38 .\"
39 .TH CHMOD 2 2010-09-26 "Linux" "Linux Programmer's Manual"
40 .\"O .SH NAME
41 .SH 名前
42 .\"O chmod, fchmod \- change permissions of a file
43 chmod, fchmod \- ファイルのモードを変更する
44 .\"O .SH SYNOPSIS
45 .SH 書式
46 .B #include <sys/stat.h>
47 .sp
48 .BI "int chmod(const char *" path ", mode_t " mode );
49 .br
50 .BI "int fchmod(int " fd ", mode_t " mode );
51 .sp
52 .in -4n
53 .\"O Feature Test Macro Requirements for glibc (see
54 .\"O .BR feature_test_macros (7)):
55 glibc 向けの機能検査マクロの要件
56 .RB ( feature_test_macros (7)
57 参照):
58 .in
59 .sp
60 .ad l
61 .PD 0
62 .BR fchmod ():
63 .RS 4
64 _BSD_SOURCE ||
65 _XOPEN_SOURCE\ >=\ 500 ||
66 _XOPEN_SOURCE\ &&\ _XOPEN_SOURCE_EXTENDED
67 .br
68 .\"O || /* Since glibc 2.12: */ _POSIX_C_SOURCE\ >=\ 200809L
69 || /* glibc 2.12 以降: */ _POSIX_C_SOURCE\ >=\ 200809L
70 .PD
71 .ad
72 .\"O .SH DESCRIPTION
73 .SH 説明
74 .\"O These system calls change the permissions of a file.
75 .\"O They differ only in how the file is specified:
76 これらのシステムコールはファイルのアクセス許可 (permission) を変更する。
77 システムコール間の違いは、ファイルの指定の仕方だけである。
78 .IP * 2
79 .\"O .BR chmod ()
80 .\"O changes the permissions of the file specified whose pathname is given in
81 .\"O .IR path ,
82 .\"O which is dereferenced if it is a symbolic link.
83 .BR chmod ()
84 は、
85 .I path
86 で指定されたパス名を持つファイルの許可を変更する。
87 .I path
88 がシンボリック・リンクの場合は、リンクの展開が行われる。
89 .IP *
90 .\"O .BR fchmod ()
91 .\"O changes the permissions of the file referred to by the open file descriptor
92 .\"O .IR fd .
93 .BR fchmod ()
94 は、オープンされたファイルディスクリプタ
95 .I fd
96 により参照されるファイルの許可を変更する。
97 .PP
98 .\"O The new file permissions are specified in
99 .\"O .IR mode ,
100 .\"O which is a bit mask created by ORing together zero or
101 .\"O more of the following:
102 新しいファイル許可は
103 .I mode
104 で指定される。
105 .I mode
106 は、以下に示す値の 0 個以上の OR (論理和) をとって作成される
107 ビットマスクである。
108 .TP 18
109 .BR S_ISUID "  (04000)"
110 .\"O set-user-ID (set process effective user ID on
111 .\"O .BR execve (2))
112 set-user-ID
113 .RB ( execve (2)
114 時にプロセスの実効ユーザ ID にセットされる)
115 .TP
116 .BR S_ISGID "  (02000)"
117 .\"O set-group-ID (set process effective group ID on
118 .\"O .BR execve (2);
119 .\"O mandatory locking, as described in
120 .\"O .BR fcntl (2);
121 .\"O take a new file's group from parent directory, as described in
122 .\"O .BR chown (2)
123 .\"O and
124 .\"O .BR mkdir (2))
125 set-group-ID
126 (以下の場合に
127 .RB ( execve (2)
128 実行時にプロセスの実効グループ ID にセットされる、
129 強制ロック (mandatory locking) を行う
130 .RB ( fcntl (2)
131 の説明を参照)、
132 新しいファイルのグループとして親ディレクトリと同じものを使う
133 .RB ( chown (2)
134
135 .BR ( mkdir (2)
136 の説明を参照)
137 .TP
138 .BR S_ISVTX "  (01000)"
139 .\"O sticky bit (restricted deletion flag, as described in
140 .\"O .BR unlink (2))
141 スティッキー・ビット (sticky bit) (削除制限フラグ、
142 .BR unlink (2)
143 の説明を参照)
144 .TP
145 .BR S_IRUSR "  (00400)"
146 .\"O read by owner
147 所有者による読み取り
148 .TP
149 .BR S_IWUSR "  (00200)"
150 .\"O write by owner
151 所有者による書き込み
152 .TP
153 .BR S_IXUSR "  (00100)"
154 .\"O execute/search by owner ("search" applies for directories,
155 .\"O and means that entries within the directory can be accessed)
156 所有者による実行 (execute) / 検索 (search)
157 (「検索」はディレクトリに対して適用されるもので、
158 そのディレクトリ内のエントリーへアクセスできるかを意味する)
159 .TP
160 .BR S_IRGRP "  (00040)"
161 .\"O read by group
162 グループによる読み取り
163 .TP
164 .BR S_IWGRP "  (00020)"
165 .\"O write by group
166 グループによる書き込み
167 .TP
168 .BR S_IXGRP "  (00010)"
169 .\"O execute/search by group
170 グループによる実行 / 検索
171 .TP
172 .BR S_IROTH "  (00004)"
173 .\"O read by others
174 他人 (others) による読み取り
175 .TP
176 .BR S_IWOTH "  (00002)"
177 .\"O write by others
178 他人による書き込み
179 .TP
180 .BR S_IXOTH "  (00001)"
181 .\"O execute/search by others
182 他人による実行 / 検索
183 .PP
184 .\"O The effective UID of the calling process must match the owner of the file,
185 .\"O or the process must be privileged (Linux: it must have the
186 .\"O .B CAP_FOWNER
187 .\"O capability).
188 呼び出したプロセスの実効 (effective) UID がファイルの所有者と一致するか、
189 そのプロセスが特権を持たなければならない
190 (Linux では
191 .B CAP_FOWNER
192 ケーパビリティ (capability) を持たなければならない)。
193
194 .\"O If the calling process is not privileged (Linux: does not have the
195 .\"O .B CAP_FSETID
196 .\"O capability), and the group of the file does not match
197 .\"O the effective group ID of the process or one of its
198 .\"O supplementary group IDs, the
199 .\"O .B S_ISGID
200 .\"O bit will be turned off,
201 .\"O but this will not cause an error to be returned.
202 呼び出したプロセスに特権がなく (Linux では
203 .B CAP_FSETID
204 ケーパビリティがなく)、かつファイルのグループ ID が
205 プロセスの実効グループ ID または補助的なグループ ID にマッチしない場合、
206 .B S_ISGID
207 ビットはオフにされるが、これによってエラーが返されることはない。
208
209 .\"O As a security measure, depending on the file system,
210 .\"O the set-user-ID and set-group-ID execution bits
211 .\"O may be turned off if a file is written.
212 安全のための処置として、
213 ファイル・システムによっては、ファイルの書き込みを行う時に
214 セット・ユーザー ID とセット・グループ ID ビットと実行ビットが
215 オフにされることがある。
216 .\"O (On Linux this occurs if the writing process does not have the
217 .\"O .B CAP_FSETID
218 .\"O capability.)
219 (Linux では、書き込みプロセスが
220 .B CAP_FSETID
221 ケーパビリティを持っていない場合に、これが起こる。)
222 .\"O On some file systems, only the superuser can set the sticky bit,
223 .\"O which may have a special meaning.
224 .\"O For the sticky bit, and for set-user-ID and set-group-ID bits on
225 .\"O directories, see
226 .\"O .BR stat (2).
227 ファイル・システムの中には、スーパー・ユーザーだけが
228 特別の意味を持つスティッキー・ビットを設定できるものがある。
229 スティッキー・ビットとディレクトリに対する
230 セット・ユーザー (グループ)・ID ビットについては、
231 .BR stat (2)
232 を見よ。
233
234 .\"O On NFS file systems, restricting the permissions will immediately influence
235 .\"O already open files, because the access control is done on the server, but
236 .\"O open files are maintained by the client.
237 .\"O Widening the permissions may be
238 .\"O delayed for other clients if attribute caching is enabled on them.
239 NFS ファイルシステム上では、パーミッションを制限すると、
240 既にオープンされているファイルに対してすぐに影響が及ぶ。
241 これはアクセス制御がサーバー上で行われているが、
242 オープンされているファイルはクライアント側で管理されているためである。
243 クライアント側でファイル属性のキャッシュが有効になっている場合に、
244 パーミッションの制限を緩くすると、
245 他のクライアントに情報が伝わるのが遅れるかもしれない。
246 .\"O .SH "RETURN VALUE"
247 .SH 返り値
248 .\"O On success, zero is returned.
249 .\"O On error, \-1 is returned, and
250 .\"O .I errno
251 .\"O is set appropriately.
252 成功すると、0 を返す。失敗すると、\-1を返し、
253 .I errno
254 に適切な値を設定する。
255 .\"O .SH ERRORS
256 .SH エラー
257 .\"O Depending on the file system, other errors can be returned.
258 .\"O The more general errors for
259 .\"O .BR chmod ()
260 .\"O are listed below:
261 ファイル・システムによっては他のエラーを返す場合がある。
262 .BR chmod ()
263 で一般的なエラーを以下に挙げる。
264 .TP
265 .B EACCES
266 .\"O Search permission is denied on a component of the path prefix.
267 .\"O (See also
268 .\"O .BR path_resolution (7).)
269 パス名の構成要素に検索許可がない
270 .RB ( path_resolution (7)
271 も見よ)。
272 .TP
273 .B EFAULT
274 .\"O .I path
275 .\"O points outside your accessible address space.
276 .I path
277 が割り当てられたアドレス空間外を指している。
278 .TP
279 .B EIO
280 .\"O An I/O error occurred.
281 I/O エラーが発生した。
282 .TP
283 .B ELOOP
284 .\"O Too many symbolic links were encountered in resolving
285 .\"O .IR path .
286 .I path
287 を解決する際に遭遇したシンボリック・リンクが多過ぎる。
288 .TP
289 .B ENAMETOOLONG
290 .\"O .I path
291 .\"O is too long.
292 .I path
293 が長過ぎる。
294 .TP
295 .B ENOENT
296 .\"O The file does not exist.
297 ファイルが存在しない。
298 .TP
299 .B ENOMEM
300 .\"O Insufficient kernel memory was available.
301 カーネルに十分なメモリがない。
302 .TP
303 .B ENOTDIR
304 .\"O A component of the path prefix is not a directory.
305 パス名の構成要素がディレクトリではない。
306 .TP
307 .B EPERM
308 .\"O The effective UID does not match the owner of the file,
309 .\"O and the process is not privileged (Linux: it does not have the
310 .\"O .B CAP_FOWNER
311 .\"O capability).
312 実効 UID がファイルの所有者と一致せず、プロセスに特権がない
313 (Linux では
314 .B CAP_FOWNER
315 ケーパビリティを持たない)。
316 .TP
317 .B EROFS
318 .\"O The named file resides on a read-only file system.
319 ファイルが読み込み専用 (read only) のファイル・システム上にある。
320 .PP
321 .\"O The general errors for
322 .\"O .BR fchmod ()
323 .\"O are listed below:
324 .BR fchmod ()
325 で一般的なエラーを挙げる:
326 .TP
327 .B EBADF
328 .\"O The file descriptor
329 .\"O .I fd
330 .\"O is not valid.
331 ファイル・ディスクリプター
332 .I fd
333 が有効でない。
334 .TP
335 .B EIO
336 .\"O See above.
337 上記を参照。
338 .TP
339 .B EPERM
340 .\"O See above.
341 上記を参照。
342 .TP
343 .B EROFS
344 .\"O See above.
345 上記を参照。
346 .\"O .SH "CONFORMING TO"
347 .SH 準拠
348 4.4BSD, SVr4, POSIX.1-2001.
349 .\"O .SH "SEE ALSO"
350 .SH 関連項目
351 .BR chown (2),
352 .BR execve (2),
353 .BR fchmodat (2),
354 .BR open (2),
355 .BR stat (2),
356 .BR path_resolution (7)