1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276
|
.\" Hey Emacs! This file is -*- nroff -*- source.
.\"
.\" This manpage is Copyright (C) 1992 Drew Eckhardt;
.\" 1993 Michael Haardt, Ian Jackson.
.\" and Copyright (C) 2007 Michael Kerrisk <mtk.manpages@gmail.com>
.\"
.\" Permission is granted to make and distribute verbatim copies of this
.\" manual provided the copyright notice and this permission notice are
.\" preserved on all copies.
.\"
.\" Permission is granted to copy and distribute modified versions of this
.\" manual under the conditions for verbatim copying, provided that the
.\" entire resulting derived work is distributed under the terms of a
.\" permission notice identical to this one.
.\"
.\" Since the Linux kernel and libraries are constantly changing, this
.\" manual page may be incorrect or out-of-date. The author(s) assume no
.\" responsibility for errors or omissions, or for damages resulting from
.\" the use of the information contained herein. The author(s) may not
.\" have taken the same level of care in the production of this manual,
.\" which is licensed free of charge, as they might when working
.\" professionally.
.\"
.\" Formatted or processed versions of this manual, if unaccompanied by
.\" the source, must acknowledge the copyright and authors of this work.
.\"
.\" Modified 1993-07-21 Rik Faith (faith@cs.unc.edu)
.\" Modified 1994-08-21 by Michael Chastain (mec@shell.portal.com):
.\" Removed note about old kernel (pre-1.1.44) using wrong id on path.
.\" Modified 1996-03-18 by Martin Schulze (joey@infodrom.north.de):
.\" Stated more clearly how it behaves with symbolic links.
.\" Added correction due to Nick Duffek (nsd@bbc.com), aeb, 960426
.\" Modified 1996-09-07 by Michael Haardt:
.\" Restrictions for NFS
.\" Modified 1997-09-09 by Joseph S. Myers <jsm28@cam.ac.uk>
.\" Modified 1998-01-13 by Michael Haardt:
.\" Using access is often insecure
.\" Modified 2001-10-16 by aeb
.\" Modified 2002-04-23 by Roger Luethi <rl@hellgate.ch>
.\" Modified 2004-06-23 by Michael Kerrisk
.\" 2007-06-10, mtk, various parts rewritten, and added BUGS section.
.\"
.\" Japanese Version Copyright (c) 1997-1998 HANATAKA Shinya
.\" all rights reserved.
.\" Translated 1997-12-17, HANATAKA Shinya <hanataka@abyss.rim.or.jp>
.\" Modified 1998-05-11, HANATAKA Shinya <hanataka@abyss.rim.or.jp>
.\" Updated 2001-12-14, Kentaro Shirakata <argrath@ub32.org>
.\" Updated 2002-06-17, Kentaro Shirakata <argrath@ub32.org>
.\" Updated 2005-02-23, Akihiro MOTOKI <amotoki@dd.iij4u.or.jp>
.\" Updated 2007-05-01, Akihiro MOTOKI, LDP v2.46
.\" Updated 2007-09-04, Akihiro MOTOKI, LDP v2.64
.\"
.\"WORD: permission
.\"WORD: privileges
.\"WORD: user 桼
.\"WORD: file system ե롦ƥ
.\"WORD: object ֥
.\"WORD: symbolic link ܥå
.\"WORD: refer Ȥ
.\"WORD: mask ޥ
.\"WORD: path ѥ
.\"WORD: effective user-ID ¸桼ID
.\"WORD: real user-ID ¥桼ID
.\"WORD: uid 桼 ID
.\"WORD: gid 롼 ID
.\"WORD: directory ǥ쥯ȥ
.\"WORD: call
.\"WORD: kernel ͥ
.\"WORD: memory
.\"WORD: dangling Τʤ
.\"
.TH ACCESS 2 2007-07-10 "Linux" "Linux Programmer's Manual"
.SH ̾
access \- եФ¥桼ǤΥå
.SH
.nf
.B #include <unistd.h>
.sp
.BI "int access(const char *" pathname ", int " mode );
.fi
.SH
.BR access ()
ϡƤӽФץե
.I pathname
˥Ǥ뤫ɤå롣
.I pathname
ܥåξ硢ܥåŸ롣
.\" F_OK is defined as 0 on every system that I know of.
.I mode
ϥåԤꤹΤǡͤ
.BR F_OK
.\" 䤬ΤäƤ뤹٤ƤΥƥ F_OK 0 Ƥ롣
⤷
.BR R_OK ", " W_OK ", " X_OK
1İʾΥӥåñ̤¤鹽ޥǤ롣
.B F_OK
ϥե뤬¸ߤ뤫ɤΤߤ롣
.BR R_OK ", " W_OK ", " X_OK
ϡե뤬¸ߤơ줾ɤ߹ߡߡ¹ԤεĤ뤫
롣
åϡºݤԤݤ˻Ѥ¸ (effective) ID Ǥʤ
ƤӽФץ
.I " (real)"
UID
.I " (real)"
GID ȤäƹԤ롣
ˤꡢset-user-ID ץǡץư桼θ¤
ñ˷ꤹ뤳ȤǤ롣
ƤӽФץøץ (Ĥޤꡢץμ UID 0) ξ硢
̾ΥեФ
.B X_OK
ΥåϡΥեνͭԡ롼ס¾ͤΤ줫
¹ԵĤͭˤʤäƤ롣
.SH ֤
(Ƥᤵ줿Ĥ줿)֤롣
顼ξ (ʤȤĤ
.I mode
ᤵ줿Ĥʤä䡢¾Υ顼)
\-1 ֤졢
.I errno
Ŭڤꤵ롣
.SH 顼
.BR access ()
ϰʲξ˼Ԥ롣
.TP
.B EACCES
ᤵ줿
Υե뼫Ȥ˵ݤ줿
.I pathname
ػޤǥǥ쥯ȥΤ줫Ф븡
(search permission) ʤä
.RB ( path_resolution (7)
⻲ȤΤ)
.TP
.B ELOOP
.I pathname
褹ݤܥå¿롣
.TP
.B ENAMETOOLONG
.I pathname
Ĺ롣
.TP
.B ENOENT
.I pathname
ѥΤ줫¸ߤʤ
Τʤ (dangling) ܥåˤʤäƤ롣
.TP
.B ENOTDIR
.I pathname
Υǥ쥯ȥʬºݤˤϥǥ쥯ȥǤʤ
.TP
.B EROFS
ɤ߹ (read-only) Υե롦ƥФƽߵĤ
ᤷ
.PP
.BR access ()
ϰʲͳˤ꼺Ԥ뤳Ȥ롣
.TP
.B EFAULT
.I pathname
ǽʥɥ쥹֤γؤƤ롣
.TP
.B EINVAL
.I mode
ͤꤵ줿
.TP
.B EIO
I/O 顼ȯ
.TP
.B ENOMEM
ͥ˽ʬʥ꤬ʤ
.TP
.B ETXTBSY
¹ΥեФƽߤᤷ
.SH
SVr4, 4.3BSD, POSIX.1-2001.
.SH
.PP
.BR ٹ :
桼㤨
.BR open (2)
ˤ륢ǽɤ(ºݤ˹Ԥ)
.BR access ()
ȤäƥåΤϡƥۡθˤʤ롣
ʤʤåƤ
ºݤ˥եΥץ֤ûֳ֤ѤǤ뤫Ǥ롣
.BR ͳΤǡΥƥॳȤΤ٤Ǥ롣
.PP
.I mode
ǻꤵ줿̤Τ줫ĤǤݤȡ
Ȥ
.I mode
ǻꤵ줿¾Υ̤Ĥ줿ȤƤ⡢
.BR access ()
ϥ顼֤
.PP
POSIX.1-2001 Ǥϡ
ƤӽФץŬڤøäƤ
(Ĥޤꡢѡ桼ξ)
Ȥեμ¹ԵĥӥåȤåȤƤʤƤ
.B X_OK
ΥåȤ֤ǧƤ롣
.\" HPU-UX 11 Tru64 5.1 ϤΤ褦ˤʤäƤ롣
Linux ϤΤ褦ˤϤʤäƤʤ
.PP
.I pathname
Υץեåǥ쥯ȥƤФ
(ʤ¹ԥ) Ĥ줿ˤΤߡ
եϥǽȤʤ롣
줫Υǥ쥯ȥ꤬ԲĤξ硢
ե뼫ȤΥĤ˴ؤ餺
.BR access ()
ϼԤ롣
.PP
ӥåȤΤߤå졢եμƤϥåʤ
äơǥ쥯ȥ꤬߲ǽȤʤäϡǥ쥯ȥ
ե뤳ȤǽʤȤ̣ΤǤꡢǥ쥯ȥ
եȤƽळȤǤ櫓ǤϤʤ
Ʊͤ DOS Υեϡּ¹ԲǽפȽǤ뤬
.BR execve (2)
ϼԤ
.PP
.BR access ()
ϡ UID ޥåԥѤ NFS ե롦ƥǤ
ǽʤ⤷ʤʤʤ UID ΥޥåԥϥС
Ԥʤ졢Υå륯饤ȤˤϸʤǤ롣
.SH Х
С 2.4 (Ȥ) Υͥˤϡѡ桼Ǥ
.B X_OK
Υåΰ˴̯롣
ǥ쥯ȥʳΥե
(桼롼ס¾ͤ) ƤΥƥˤĤ
¹ԵĤʤ硢
.BR access ()
Υå \-1 ֤Τ
.I mode
.B X_OK
ꤵ줿ȤǤ
.I mode
.B R_OK
.B W_OK
˻ꤵ줿ˤ
.BR access ()
0 ֤
.\" εưϼλΤä褦Ǥ롣
(С 2.6.3 ) 2.6 ϤΥͥ
2.4 ϤΥͥƱͤư롣
2.6.20 ΥͥǤϡ
ե뤬¸ߤե륷ƥ
.BR mount (2)
ݤ˻ꤵ줿
.B MS_NOEXEC
ե饰θ̤
.BR access ()
̵뤷Ƥ
ͥ 2.6.20 ʹߤǤϡ
.BR access ()
ϤΥե饰θ褦ˤʤäƤ롣
.SH Ϣ
.BR chmod (2),
.BR chown (2),
.BR faccessat (2),
.BR open (2),
.BR setgid (2),
.BR setuid (2),
.BR stat (2),
.BR eauidaccess (3),
.BR credentials (7),
.BR path_resolution (7)
|